D1760: commands: check for empty rev before passing to scmutil.unhidehashlikerevs

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Thu Dec 28 14:41:06 EST 2017


pulkit updated this revision to Diff 4659.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1760?vs=4621&id=4659

REVISION DETAIL
  https://phab.mercurial-scm.org/D1760

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1280,7 +1280,8 @@
     """
     opts = pycompat.byteskwargs(opts)
     rev = opts.get('rev')
-    repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+    if rev:
+        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
     ctx = scmutil.revsingle(repo, rev)
     m = scmutil.match(ctx, (file1,) + pats, opts)
     fntemplate = opts.pop('output', '')
@@ -1995,7 +1996,8 @@
 
     opts = pycompat.byteskwargs(opts)
     rev = opts.get('rev')
-    repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+    if rev:
+        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
     ctx = scmutil.revsingle(repo, rev, None)
 
     end = '\n'
@@ -2779,7 +2781,8 @@
         fm.data(node=hex(remoterev))
         fm.data(bookmarks=fm.formatlist(bms, name='bookmark'))
     else:
-        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+        if rev:
+            repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
         ctx = scmutil.revsingle(repo, rev, None)
 
         if ctx.rev() is None:
@@ -3513,7 +3516,8 @@
 
     char = {'l': '@', 'x': '*', '': ''}
     mode = {'l': '644', 'x': '755', '': '644'}
-    repo = scmutil.unhidehashlikerevs(repo, [node], 'nowarn')
+    if node:
+        repo = scmutil.unhidehashlikerevs(repo, [node], 'nowarn')
     ctx = scmutil.revsingle(repo, node)
     mf = ctx.manifest()
     ui.pager('manifest')
@@ -3702,7 +3706,8 @@
 
     opts = pycompat.byteskwargs(opts)
     rev = opts.get('rev')
-    repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+    if rev:
+        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
     ctx = scmutil.revsingle(repo, rev, None)
 
     if file_:



To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list