summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@jelmer.uk>2017-03-01 20:14:39 +0000
committerJelmer Vernooij <jelmer@jelmer.uk>2017-03-01 20:14:39 +0000
commitf41fe075fc0387b8470299569be49912daa33543 (patch)
treefc3f5a1fe3d2c4bd6845d9686bd0844e5de114ed
parenta6157569c288dc6586145b1f4425b23aa88eaecd (diff)
Add really basic pull command.
-rwxr-xr-xbin/dulwich13
-rw-r--r--dulwich/porcelain.py6
2 files changed, 18 insertions, 1 deletions
diff --git a/bin/dulwich b/bin/dulwich
index f64d2fa4..b9a24655 100755
--- a/bin/dulwich
+++ b/bin/dulwich
@@ -468,6 +468,18 @@ class cmd_pack_objects(Command):
f.close()
+class cmd_pull(Command):
+
+ def run(self, args):
+ parser = optparse.OptionParser()
+ options, args = parser.parse_args(args)
+ try:
+ from_location = args[0]
+ except IndexError:
+ from_location = None
+ porcelain.pull('.', from_location)
+
+
class cmd_remote_add(Command):
def run(self, args):
@@ -536,6 +548,7 @@ commands = {
"ls-remote": cmd_ls_remote,
"ls-tree": cmd_ls_tree,
"pack-objects": cmd_pack_objects,
+ "pull": cmd_pull,
"receive-pack": cmd_receive_pack,
"remote": cmd_remote,
"repack": cmd_repack,
diff --git a/dulwich/porcelain.py b/dulwich/porcelain.py
index 6d5cd99e..b538049a 100644
--- a/dulwich/porcelain.py
+++ b/dulwich/porcelain.py
@@ -692,7 +692,7 @@ def push(repo, remote_location, refspecs=None,
b"\n")
-def pull(repo, remote_location, refspecs=None,
+def pull(repo, remote_location=None, refspecs=None,
outstream=default_bytes_out_stream, errstream=default_bytes_err_stream):
"""Pull from remote via dulwich.client
@@ -704,6 +704,10 @@ def pull(repo, remote_location, refspecs=None,
"""
# Open the repo
with open_repo_closing(repo) as r:
+ if remote_location is None:
+ # TODO(jelmer): Lookup 'remote' for current branch in config
+ raise NotImplementedError(
+ "looking up remote from branch config not supported yet")
if refspecs is None:
refspecs = [b"HEAD"]
selected_refs = []