[PATCH 1 of 2] unbundle command does not accept multiple file arguments

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Apr 25 15:15:08 UTC 2007


# HG changeset patch
# User Giorgos Keramidas <keramida at ceid.upatras.gr>
# Date 1177513354 -10800
# Node ID 01961367edf80514d51af1128b86384cd76cfc06
# Parent  bf8319ee3428048a9ef96cc855492860f88ecceb
unbundle command does not accept multiple file arguments

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2555,19 +2555,25 @@ def tip(ui, repo, **opts):
     """
     cmdutil.show_changeset(ui, repo, opts).show(nullrev+repo.changelog.count())
 
-def unbundle(ui, repo, fname, **opts):
-    """apply a changegroup file
-
-    Apply a compressed changegroup file generated by the bundle
-    command.
-    """
-    if os.path.exists(fname):
-        f = open(fname, "rb")
-    else:
-        f = urllib.urlopen(fname)
-    gen = changegroup.readbundle(f, fname)
-    modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
-    return postincoming(ui, repo, modheads, opts['update'])
+def unbundle(ui, repo, fname1, *fnames, **opts):
+    """apply one or more changegroup files
+
+    Apply one or more compressed changegroup files generated by the
+    bundle command.
+    """
+    fnames = (fname1,) + fnames
+    result = None
+    for fname in fnames:
+        if os.path.exists(fname):
+            f = open(fname, "rb")
+        else:
+            f = urllib.urlopen(fname)
+        gen = changegroup.readbundle(f, fname)
+        modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
+        result = postincoming(ui, repo, modheads, opts['update'])
+        if result:
+            return result
+    return result
 
 def update(ui, repo, node=None, clean=False, date=None):
     """update working directory
@@ -2997,7 +3003,7 @@ table = {
         (unbundle,
          [('u', 'update', None,
            _('update to new tip if changesets were unbundled'))],
-         _('hg unbundle [-u] FILE')),
+         _('hg unbundle [-u] FILE...')),
     "^update|up|checkout|co":
         (update,
          [('C', 'clean', None, _('overwrite locally modified files')),



More information about the Mercurial-devel mailing list