aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/git/repository.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-01-12 15:24:57 +0200
committerGuido Günther <agx@sigxcpu.org>2012-01-15 19:58:02 +0100
commit3aa8b0b7a8c4023cd6bfa38af5a578763f6fa205 (patch)
tree21caa5dc992268033d50a4b109c7f4c68b7e6d76 /gbp/git/repository.py
parent04fdd802e37fcf8fff01e10b9b8a04a8c54c61cd (diff)
GitRepository: add depth parameter to fetch()
Allows deepening of shallow clones.
Diffstat (limited to 'gbp/git/repository.py')
-rw-r--r--gbp/git/repository.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index e91e2627..7e7134e3 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -697,7 +697,7 @@ class GitRepository(object):
args += [ name, url ]
self._git_command("remote", args)
- def fetch(self, repo=None, tags=False):
+ def fetch(self, repo=None, tags=False, depth=0):
"""
Download objects and refs from another repository.
@@ -705,9 +705,12 @@ class GitRepository(object):
@type repo: C{str}
@param tags: whether to fetch all tag objects
@type tags: C{bool}
+ @param depth: deepen the history of (shallow) repository to depth I{depth}
+ @type depth: C{int}
"""
args = GitArgs('--quiet')
args.add_true(tags, '--tags')
+ args.add_cond(depth, '--depth=%s' % depth)
args.add_cond(repo, repo)
self._git_command("fetch", args.args)