150 Commits

Author SHA1 Message Date
Nico von Geyso
682fb1fd13 merged create_reference and create_reference_symbolic and added force-Option
To be more pythonic: merged methods create_reference and create_reference_symbolic
and added force-Option. To make a new symbolic reference you have provide symbolic=True
as an additional parameter. If force=True references will although be overridden.
Otherwise an exception is raised if the references exists.

Examples:

  # normal reference
    repo.create_reference('refs/heads/foo', repo.head.hex)

  # override reference with new value
    repo.create_reference('refs/heads/foo', repo.head.hex, force=True)

  # symbolic reference
    repo.create_reference('refs/tags/foo', 'refs/heads/master', symbolic = True)
2012-10-09 13:13:36 +02:00
J. David Ibáñez
ad8103bc48 Fix reference test case
Now git_reference_lookup says "foo" is an invalid reference name
(returns GITERR_REFERENCE instead of GIT_ENOTFOUND).
2012-10-03 14:08:27 +02:00
J. David Ibáñez
5251343ee7 Merge remote-tracking branch 'wking/revparse' 2012-09-25 15:10:55 +02:00
J. David Ibáñez
1be3e8301d Get a useful traceback when importing pygit2 fails 2012-09-22 19:07:15 +02:00
J. David Ibáñez
a72fab5a76 Merge remote-tracking branch 'bendavis/git_tree_entry_bypath' 2012-09-21 16:52:38 +02:00
J. David Ibáñez
6654716eb3 Merge remote-tracking branch 'wking/kwargs-signature' 2012-09-19 20:34:43 +02:00
W. Trevor King
36ae908de2 test: use Signature(encoding=...) in test_commit and test_signature.
Correct tests now that the default name encoding is ASCII.
2012-09-17 14:52:30 -04:00
Ridge Kennedy
bc0c0e17a8 Add Blob.size 2012-09-16 22:56:36 +12:00
J. David Ibáñez
430f4dc343 Fix typo in repository test 2012-09-14 14:04:02 +02:00
W. Trevor King
0238fb72df repository: add Repository.revparse_single().
This provides access to libgit2's 'git_revparse_single'.
2012-09-13 17:09:12 -04:00
W. Trevor King
5464eaaf50 Merge branch 'test_repository' into revparse
Get the correct HEAD_SHA for the upcoming revparse_single test.
2012-09-13 17:00:35 -04:00
W. Trevor King
437c1af33f test_repository: fix HEAD_SHA -> 2cdae2 and use assertEqual when testing.
The previous test always passed, because bool(HEAD_SHA) is True.

The update to HEAD_SHA should have happened in:

  commit c06e10e67e746099b8d454212acc56391199eb31
  Author: Petr Hosek <p.hosek@imperial.ac.uk>
  Date:   Tue May 29 17:41:07 2012 +0100

    Support for diff merge operation added
2012-09-13 16:54:07 -04:00
W. Trevor King
477e48ef6c test_diff: hunk.old_lines should be 1 in test_diff_tree and test_diff_merge.
In both cases, the file contents change from 'X contents\n' to 'X
contents 2\n' (where 'X' is 'a' or 'b').  This means were removing one
line and adding another.

I'm not sure how this test was passing against libgit2 v0.17.0, so I
may be missing something important.
2012-09-13 16:30:21 -04:00
W. Trevor King
651aa6a830 tree: rename Tree.attributes to Tree.filemode.
This catches up with changes in libgit2:

  commit 9d7ac675d06dab2e000ad32f9248631af0191f85
  Author: nulltoken <emeric.fermas@gmail.com>
  Date:   Tue Aug 21 11:45:16 2012 +0200

    tree entry: rename git_tree_entry_attributes() into git_tree_entry_filemode()
2012-09-13 16:14:24 -04:00
Petr Viktorin
97aba6b14b Make time and offset arguments to Signature optional
If these are left blank, use git_signature_now to insert the current time.
Specifying one but not the other causes a TypeError.
Test inlcluded.
2012-09-07 23:51:36 +02:00
Alex Chamberlain
1a2dd95575 Added unit test for Repository.create_blob_fromfile 2012-08-24 10:47:12 +01:00
Carlos Martín Nieto
f3dab28082 diff: add old and new OID values to Hunk
These can be important, and are necessary to create a patch from this
data.
2012-08-15 20:37:43 +02:00
Carlos Martín Nieto
11d0c9a30f diff: expose the hunk header
We can rebuild it from the data we already have, but this will allow
us to get the function headers in it once the library supports it.
2012-08-15 20:07:49 +02:00
Carlos Martín Nieto
db35bda219 Run the diff tests 2012-08-15 19:54:59 +02:00
Ben Davis
689412d0a2 Added error checking when calling git_tree_entry_bypath 2012-08-11 16:24:30 -05:00
Carlos Martín Nieto
578054b97b config test: the loop should return 0
Returning anything else makes the loop stop, which stops us from
getting to 'core.bare' which the test is looking for.
2012-08-06 17:54:26 +02:00
Ben Davis
398e717ec6 Implemented git_tree_entry_bypath within Tree.__getitem__ 2012-08-03 01:09:45 -05:00
J. David Ibáñez
edcd803e7e Remove the __authors__ var from py files 2012-07-18 12:12:04 +02:00
J. David Ibáñez
6195491596 Add/update copyright header of each file
And update my email address.
2012-07-18 12:07:17 +02:00
J. David Ibáñez
ec8047a8c5 Fix errors detected by pyflakes 2012-06-18 11:36:27 -03:00
J. David Ibáñez
1f354149a3 tests: don't leave test files behind 2012-06-18 11:28:19 -03:00
J. David Ibáñez
d27cf0b687 style: remove trailing white-spaces 2012-06-18 11:22:56 -03:00
J. David Ibáñez
9ba2324535 Fix unit tests for Python 2.6 2012-06-18 11:08:46 -03:00
authmillenon
b6b4007ffd Fixed bug in test_add. 2012-06-15 14:14:22 +02:00
Martin Lenders
3df090c761 Implement getting and setting of multivars 2012-06-08 18:34:54 +02:00
Martin Lenders
1acd488c68 Wrap git_config_foreach in Config 2012-06-08 18:34:54 +02:00
Martin Lenders
e126b09380 Implement dictionary-like behaviour for Config 2012-06-08 18:34:54 +02:00
Martin Lenders
e77d248713 Add back reference from Repository to Config 2012-06-08 18:34:54 +02:00
Martin Lenders
fcacea310b Implement addition of files to Config 2012-06-08 18:34:54 +02:00
Martin Lenders
068b833c87 Add getter for global and system config 2012-06-08 18:34:54 +02:00
Martin Lenders
c4d17b759b Create Config type 2012-06-08 18:34:54 +02:00
Christian Boos
38d5bf03ad tests: new fancy asserts are for Python 2.7 only 2012-06-06 15:58:07 +02:00
J. David Ibáñez
1e1750f8da Merge remote branch 'perth/master' 2012-05-31 13:32:25 +02:00
J. David Ibáñez
a55d4da18a Merge remote branch 'cholin/head_getter' 2012-05-31 09:52:54 +02:00
Petr Hosek
d054788d19 Synchronized with upstream 2012-05-30 20:43:26 +01:00
Nico von Geyso
e8c8fa29b7 Merge branch 'master' of https://github.com/libgit2/pygit2 into head_getter 2012-05-30 14:44:12 +02:00
Nico von Geyso
89354bc606 Merge branch 'master' of https://github.com/libgit2/pygit2 into reflog 2012-05-30 14:39:34 +02:00
Nico von Geyso
ce4e411135 added revlog 2012-05-30 14:39:02 +02:00
Nico von Geyso
eb62331b36 added missing tests 2012-05-30 08:32:13 +02:00
Nico von Geyso
ade2e5812c support for diff against workdir or index
Added missing support for a diff against workdir or an index.
The latter one differs from `git diff HEAD` because git itself
does a merge of workdir and index (see docs of git_diff_workdir_to_tree).
2012-05-30 07:58:31 +02:00
Petr Hosek
c06e10e67e Support for diff merge operation added 2012-05-29 17:41:07 +01:00
Nico von Geyso
e402d0e9eb added head-getter for Repository
You do not have to lookup and resolve the HEAD reference anymore if you simply want
the last commit. Repository has now a head-getter which combines all these steps.

example:
  repo = Repository('.')
  head = repo.head
  print(head.message)
2012-05-28 12:41:43 +02:00
Nico von Geyso
3bb00107d2 added old and new file path for hunks 2012-05-25 10:35:39 +02:00
Nico von Geyso
2a49eadc57 added some tests for diff 2012-05-24 19:10:00 +02:00
Nico von Geyso
c04ba3ac2b python3 compatibility
fixed unicode/byte string issues for python3
2012-05-15 11:24:03 +02:00