D3016: clone: rename "rev" to "revs" since there can be many
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon Apr 2 15:47:08 UTC 2018
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3016
AFFECTED FILES
hgext/mq.py
mercurial/commands.py
mercurial/hg.py
CHANGE DETAILS
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -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)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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'))
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -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'))
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list