88 Commits

Author SHA1 Message Date
Tamir Bahar
3818555e14 Added Repository.references accessor. 2017-04-21 08:51:41 +00:00
Tamir Bahar
320ee5e733 Added GIT_BRANCH_ALL 2017-04-19 21:10:11 +03:00
Tamir Bahar
d14438725e Added basic Repository.branches implementation. 2017-04-17 23:02:58 +03:00
Nick Hynes
9be907983f Wrap stash_pop 2017-03-27 16:42:38 -04:00
Nick Hynes
b31ac50210 Wrap stash_drop 2017-03-27 16:33:32 -04:00
Nick Hynes
da233b16c5 Wrap git_stash_apply 2017-03-27 16:31:21 -04:00
Nick Hynes
1a842ff8bd Wrap git_stash_save 2017-03-27 16:20:33 -04:00
J. David Ibáñez
354d56a95c Update copyright years 2017-03-22 21:15:34 +01:00
Matthaus Woolard
4fbc1f1c05 Add support for custom backends
Signed-off-by: Matthaus Woolard <matthaus.woolard@gmail.com>
2017-02-09 15:57:56 +00:00
Tamir Bahar
5c061cbb0a Remove unused code
Removed a chunk of code from `checkout` that did nothing, but had a bug.
When checking out from a branch-less state (like the state when a repository is first initialized) the code failed.
The failure was due to trying to get some properties of the current branch, which were never used in the code.
2017-01-03 01:17:48 +02:00
mrh1997
ffc514fa24 Ammend the doc-string of Repository.diff()
According to the old documentation, it was not clear how to compare 
working directory/index to a git object.
2016-07-11 14:41:39 +02:00
J. David Ibáñez
d8fd2e78d8 Merge remote-tracking branch 'ignatenkobrain/gh620' 2016-04-17 20:48:56 +02:00
Igor Gnatenko
fd9a39a91b repository: decode() linkname
Reference: https://github.com/libgit2/pygit2/issues/620
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-04-15 14:13:47 +02:00
Igor Gnatenko
270dad8cd3 repository: SYMTYPE is constant in module tarfile, not in any class
Reference: https://github.com/libgit2/pygit2/issues/618
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-04-15 14:07:33 +02:00
Yu Jianjian
51915ddf0e wrong order of the args in docstring of write_archive 2016-03-23 23:33:20 +08:00
Thom Wiggers
735510f14d
Fix repository crash if path passed is not a str
Tries to decode any non-string objects (such as bytes)

Introduces `six` as a dependency

Closes #588
2016-02-28 12:32:51 +01:00
Carlos Martín Nieto
487fb5913e Keep the describe dirty suffix string alive 2016-02-25 08:04:27 +01:00
Noah Fontes
99dfce9ab8 Add support for Repository.describe(...). 2015-12-05 23:22:37 -08:00
J. David Ibáñez
70edbf256a Update copyright years 2015-10-11 18:48:59 +02:00
Carlos Martín Nieto
81520c9c62 Update to libgit2 v0.23 2015-07-06 18:49:20 +02:00
Carlos Martín Nieto
74b81bf180 Add support for querying attributes
Expose a method in the repository which allows querying an attribute for
a file and converts the result to the python equivalent.
2015-05-20 20:56:40 +02:00
J. David Ibáñez
8a196f656b Merge remote-tracking branch 'cjwatson/merge-index-path-refs' 2015-05-03 11:33:28 +02:00
J. David Ibáñez
deb50536f0 docs: remove manual singatures from py files
These are only needed in C code. With Python files the signatures are
automatically generated. The only drawback is the return value is not
included in the signature, so document it in the body of the docstring.
2015-05-03 11:16:17 +02:00
Colin Watson
efb49f8418 Keep path references in merge_file_from_index
IndexEntry._to_c requires its caller to hold a reference to the path it
returns until it no longer needs the C structure.
Repository.merge_file_from_index was not doing so, causing the merge
text to contain garbage from freed memory in some cases.
2015-04-23 04:29:13 +01:00
Patrick Steinhardt
f923e20f2d submodule: reimplement with Python CFFI.
The submodule type has been implemented as a C type. When opening
a submodule's repository this leads to the bug that instead of an
actual pygit2.Repository being instantiated we only create an
object of the C Repository type.

As this is not trivially fixed within the C code, reimplement the
submodule type as a Python interface with CFFI. As submodules
provide no functionality that is usually accessed repeatedly the
code paths should not prove performance critical. In addition,
maintainability is improved by this reimplementation.
2015-04-16 11:36:41 +02:00
J. David Ibáñez
1f755c601c Fix indentation style 2015-04-03 09:19:29 +02:00
Santiago Perez De Rosso
08f2956e97 diff of blob to blob in repository.diff 2015-03-31 19:30:15 -04:00
Santiago Perez De Rosso
99e1cad393 bug fix in repository.diff 2015-03-31 13:49:39 -04:00
Patrick Steinhardt
cf56a695f9 Fix error when merging files with unicode content.
When merging index entries where the corresponding files contain Unicode
codepoints an error is thrown. Decode the C string using UTF-8 to fix the issue
and adjust the test case for merging files to contain umlauts to catch such
errors.
2015-03-19 07:48:18 +01:00
Patrick Steinhardt
367084e3c1 Implement merging of index entries.
This allows us to generate a textual diff of conflicting files in
bare repositories by performing a merge on the index followed by
repo.merge_file_from_index on the resulting index entries.
2015-03-11 16:08:13 +01:00
J. David Ibáñez
d64dd15bd2 Merge remote-tracking branch 'carlos/merge-trees' 2015-02-10 09:34:49 +01:00
Carlos Martín Nieto
fcd4b9446b Introduce Repository.merge_trees()
This is the function which does the work for Repository.merge_commits()
and allows us more direct control over which trees we want to merge,
including trees which do not belong to commits.
2015-02-09 21:21:28 +01:00
J. David Ibáñez
fa380c0adb Merge remote-tracking branch 'gandalf/archive_enh'
Conflicts:
	pygit2/repository.py
2015-02-07 20:35:45 +01:00
Carlos Martín Nieto
4709cae1a1 Add Repository.ahead_behind()
This lets us ask how many diverging commits each side of two histories
have.
2015-02-06 01:26:26 +01:00
Alok Singhal
f5a5dfc18a Use "prefix" instead of "root_path" in write_archive 2015-01-30 10:15:08 -08:00
Alok Singhal
3ee1c798b2 Add an option to specify root path when creating archives 2015-01-29 08:46:50 -08:00
Alok Singhal
9771adf862 Fix handling of symlinks in write_archive(). 2015-01-29 08:35:27 -08:00
Carlos Martín Nieto
1dbf94011a Migrate to 0.22
Apart from the usual API changes, we now need to introduce the concept
of whether we still own the C object underneath our Repository and
Remote objects.

When using the custom callbacks for repository and remote creation
during clone, we pass the pointer and thus ownership of the object back
to the library. We will then get the repository back at the end.

We return the object which was handed to us rather than opening the
repository again with the local path as there is now a much higher
chance that the cloned repository does not use the standard backends.
2015-01-12 18:39:21 +01:00
J. David Ibáñez
beff871923 Minor styling 2014-11-12 10:21:47 +01:00
Carlos Martín Nieto
b80103b017 Introduce RemoteCollection
This lets us look up remotes by name, which is not possible by just
returning the list of remotes.

Move remote creation to Repostiory.remotes.create() and keep the old
Repository.create_remote() for compatibility, delegating to this new
way.

Existing code should keep working, but this moves us towards what we'd
need for a better interface in 0.22 which makes remote renaming and
deleting work with a name rather than an instance and would make sense
to exist as part of an Remote.remotes object.
2014-11-11 19:57:22 +01:00
J. David Ibáñez
cb310316bf docs: fix build errors in the blame chapter 2014-11-03 18:53:38 +01:00
Carlos Martín Nieto
bc8b29b4f3 Repository: allow passing a favor option to merge_commits
I've gone with taking a string and converting it because the depth of
the namespacing in the libgit2 name is rather large and we don't care
about the global namespace that C has; and this also lets us pass the
same as the '-X' option to git-merge.
2014-10-30 16:21:22 +01:00
Carlos Martín Nieto
3b27e16d08 Add Repository.merge_commits()
This allows you to merge arbitrary commits, returning an index, which is
useful when dealing with bare repos in which we want to merge.
2014-10-30 15:04:51 +01:00
Carlos Martín Nieto
59da03476e Repository: make use of peel for diff()
Instead of trying to reimplement parts of it, make use of Object.peel()
and Reference.peel() to get to a Blob or Tree.
2014-10-07 20:27:01 +02:00
J. David Ibáñez
510f6174f1 Fix Repository.diff for references an empty trees
This should fix issue #432

By the way make the code a little more robust.
2014-10-07 18:59:04 +02:00
Carlos Martín Nieto
ab730cb1d4 Provide a method to write a tree to an archive
Add Repository.write_archive() to write a given tree to an archive. As
there are many customisation options, we only provide a method to write
to an archive which is created by the user.
2014-09-06 18:59:15 +02:00
J. David Ibáñez
82167827bc Merge remote-tracking branch 'carlos/reference-update' 2014-09-05 17:11:32 +02:00
Carlos Martín Nieto
747e7c2136 Repository: make head read-only and introduce set_head()
Following from the previous commits, make 'head' read-only and provide a
method to update head while providing a message.

The checkout() codepath which switches branches has been updated to
provide a reflog entry which mimics git's.
2014-09-04 01:58:05 +02:00
Carlos Martín Nieto
cd08425927 Move blame to cffi
This requires fairly little work on the pygit2 side to kick off all the
searching on the libgit2 side, so it's a fairly good candidate.

This changes the return value for the commit ids to Oid instead of
strings, which is what we generally try to return.
2014-08-31 22:35:32 +02:00
J. David Ibáñez
a53d8b2213 Merge remote-tracking branch 'djmattyg007/doc_fixes' 2014-08-26 10:31:53 +02:00