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

login
register
mail settings
Submitter phabricator
Date Dec. 28, 2017, 7:41 p.m.
Message ID <0f1d264acf1ecade162980af9c5846ca@localhost.localdomain>
Download mbox | patch
Permalink /patch/26481/
State Not Applicable
Headers show

Comments

phabricator - Dec. 28, 2017, 7:41 p.m.
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




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

Patch

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_: