summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-14 16:23:17 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-14 16:23:17 +0100
commitaa1b156ee96f5aabdca153c152ec6e3215fdf16f (patch)
treef3f3b3ee76a4da55f4ae1216a8219e571a161b6b /git/repo/base.py
parent619c989915b568e4737951fafcbae14cd06d6ea6 (diff)
downloadgitpython-aa1b156ee96f5aabdca153c152ec6e3215fdf16f.tar.gz
Added 'path' keyword argument to Repo.archive().
This allows sub-trees to be archived as well, and makes `.archive()` feature complete. Fixes #67
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 155a674f..afff9471 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -846,7 +846,10 @@ class Repo(object):
:parm kwargs:
Additional arguments passed to git-archive
NOTE: Use the 'format' argument to define the kind of format. Use
- specialized ostreams to write any format supported by python
+ specialized ostreams to write any format supported by python.
+
+ You may specify the special 'path' keyword, which may either be a repository-relative
+ path to a directory or file to place into the archive, or a list or tuple of multipe paths.
:raise GitCommandError: in case something went wrong
:return: self"""
@@ -855,8 +858,12 @@ class Repo(object):
if prefix and 'prefix' not in kwargs:
kwargs['prefix'] = prefix
kwargs['output_stream'] = ostream
+ path = kwargs.pop('path', list())
+ if not isinstance(path, (tuple, list)):
+ path = [path]
+ # end assure paths is list
- self.git.archive(treeish, **kwargs)
+ self.git.archive(treeish, *path, **kwargs)
return self
rev_parse = rev_parse