Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa1b156

Browse files
committed
Added 'path' keyword argument to Repo.archive().
This allows sub-trees to be archived as well, and makes `.archive()`feature complete.Fixesgitpython-developers#67
1 parent619c989 commitaa1b156

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

‎doc/source/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Changelog
55
0.3.6 - Features
66
================
77
* Added `Repo.merge_base()` implementation. See the `respective issue on github<https://github.com/gitpython-developers/GitPython/issues/169>`_
8+
* `[include]` sections in git configuration files are now respected
89
* A list of all issues can be found here: https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.6+-+Features%22+
910

1011
0.3.5 - Bugfixes

‎git/repo/base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,10 @@ def archive(self, ostream, treeish=None, prefix=None, **kwargs):
846846
:parm kwargs:
847847
Additional arguments passed to git-archive
848848
NOTE: Use the 'format' argument to define the kind of format. Use
849-
specialized ostreams to write any format supported by python
849+
specialized ostreams to write any format supported by python.
850+
851+
You may specify the special 'path' keyword, which may either be a repository-relative
852+
path to a directory or file to place into the archive, or a list or tuple of multipe paths.
850853
851854
:raise GitCommandError: in case something went wrong
852855
:return: self"""
@@ -855,8 +858,12 @@ def archive(self, ostream, treeish=None, prefix=None, **kwargs):
855858
ifprefixand'prefix'notinkwargs:
856859
kwargs['prefix']=prefix
857860
kwargs['output_stream']=ostream
861+
path=kwargs.pop('path',list())
862+
ifnotisinstance(path, (tuple,list)):
863+
path= [path]
864+
# end assure paths is list
858865

859-
self.git.archive(treeish,**kwargs)
866+
self.git.archive(treeish,*path,**kwargs)
860867
returnself
861868

862869
rev_parse=rev_parse

‎git/test/test_repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def test_tag(self):
266266
deftest_archive(self):
267267
tmpfile=tempfile.mktemp(suffix='archive-test')
268268
stream=open(tmpfile,'wb')
269-
self.rorepo.archive(stream,'0.1.5')
269+
self.rorepo.archive(stream,'0.1.6',path='doc')
270270
assertstream.tell()
271271
stream.close()
272272
os.remove(tmpfile)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp