changeset 37262:54435fd09f1d

clone: rename "rev" to "revs" since there can be many It was a little tricky in hg.clone(), since there was a local "revs" variable defined there, but "rev" was never used after "revs", so I just overwrote it. Note that clonewithshare() should also have its "rev" argument renamed to "revs", but I'll leave that to someone else. Differential Revision: https://phab.mercurial-scm.org/D3016
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 02 Apr 2018 08:46:07 -0700
parents 3809eafedf2c
children f74fdab86f16
files hgext/mq.py mercurial/commands.py mercurial/hg.py
diffstat 3 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Sun Apr 01 15:41:16 2018 -0700
+++ b/hgext/mq.py	Mon Apr 02 08:46:07 2018 -0700
@@ -2505,7 +2505,7 @@
     ui.note(_('cloning main repository\n'))
     sr, dr = hg.clone(ui, opts, sr.url(), dest,
                       pull=opts.get('pull'),
-                      rev=destrev,
+                      revs=destrev,
                       update=False,
                       stream=opts.get('uncompressed'))
 
--- a/mercurial/commands.py	Sun Apr 01 15:41:16 2018 -0700
+++ b/mercurial/commands.py	Mon Apr 02 08:46:07 2018 -0700
@@ -1460,7 +1460,7 @@
     r = hg.clone(ui, opts, source, dest,
                  pull=opts.get('pull'),
                  stream=opts.get('stream') or opts.get('uncompressed'),
-                 rev=opts.get('rev'),
+                 revs=opts.get('rev'),
                  update=opts.get('updaterev') or not opts.get('noupdate'),
                  branch=opts.get('branch'),
                  shareopts=opts.get('shareopts'))
--- a/mercurial/hg.py	Sun Apr 01 15:41:16 2018 -0700
+++ b/mercurial/hg.py	Mon Apr 02 08:46:07 2018 -0700
@@ -448,7 +448,7 @@
             # well. Never update because working copies aren't necessary in
             # share mode.
             clone(ui, peeropts, source, dest=sharepath, pull=True,
-                  rev=rev, update=False, stream=stream)
+                  revs=rev, update=False, stream=stream)
 
     # Resolve the value to put in [paths] section for the source.
     if islocal(source):
@@ -483,7 +483,7 @@
             os.mkdir(dstcachedir)
         util.copyfile(srcbranchcache, dstbranchcache)
 
-def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
+def clone(ui, peeropts, source, dest=None, pull=False, revs=None,
           update=True, stream=False, branch=None, shareopts=None):
     """Make a copy of an existing repository.
 
@@ -512,7 +512,7 @@
     stream: stream raw data uncompressed from repository (fast over
     LAN, slow over WAN)
 
-    rev: revision to clone up to (implies pull=True)
+    revs: revision to clone up to (implies pull=True)
 
     update: update working directory after clone completes, if
     destination is local repository (True means update to default rev,
@@ -536,7 +536,7 @@
         srcpeer = source.peer() # in case we were called with a localrepo
         branches = (None, branch or [])
         origsource = source = srcpeer.url()
-    rev, checkout = addbranchrevs(srcpeer, srcpeer, branches, rev)
+    revs, checkout = addbranchrevs(srcpeer, srcpeer, branches, revs)
 
     if dest is None:
         dest = defaultdest(source)
@@ -587,7 +587,7 @@
 
         if sharepath:
             return clonewithshare(ui, peeropts, sharepath, source, srcpeer,
-                                  dest, pull=pull, rev=rev, update=update,
+                                  dest, pull=pull, rev=revs, update=update,
                                   stream=stream)
 
     srclock = destlock = cleandir = None
@@ -603,7 +603,7 @@
         copy = False
         if (srcrepo and srcrepo.cancopy() and islocal(dest)
             and not phases.hassecret(srcrepo)):
-            copy = not pull and not rev
+            copy = not pull and not revs
 
         if copy:
             try:
@@ -660,14 +660,15 @@
                                      % dest)
                 raise
 
-            revs = None
-            if rev:
+            if revs:
                 if not srcpeer.capable('lookup'):
                     raise error.Abort(_("src repository does not support "
                                        "revision lookup and so doesn't "
                                        "support clone by revision"))
-                revs = [srcpeer.lookup(r) for r in rev]
+                revs = [srcpeer.lookup(r) for r in revs]
                 checkout = revs[0]
+            else:
+                revs = None
             local = destpeer.local()
             if local:
                 u = util.url(abspath)