archive: add support to specify hidden revs if directaccess config is set
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 05 Jan 2018 19:30:37 +0530
changeset 35535 ffd7b7cd309b
parent 35534 b6ce3568771d
child 35536 f04d16bef2c7
archive: add support to specify hidden revs if directaccess config is set Differential Revision: https://phab.mercurial-scm.org/D1812
mercurial/commands.py
tests/test-directaccess.t
--- a/mercurial/commands.py	Fri Jan 05 19:23:30 2018 +0530
+++ b/mercurial/commands.py	Fri Jan 05 19:30:37 2018 +0530
@@ -467,7 +467,10 @@
     '''
 
     opts = pycompat.byteskwargs(opts)
-    ctx = scmutil.revsingle(repo, opts.get('rev'))
+    rev = opts.get('rev')
+    if rev:
+        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+    ctx = scmutil.revsingle(repo, rev)
     if not ctx:
         raise error.Abort(_('no working directory: please specify a revision'))
     node = ctx.node()
--- a/tests/test-directaccess.t	Fri Jan 05 19:23:30 2018 +0530
+++ b/tests/test-directaccess.t	Fri Jan 05 19:30:37 2018 +0530
@@ -148,6 +148,11 @@
   $ hg status --change 28ad74
   A c
 
+`hg archive`
+
+This should not throw error
+  $ hg archive -r 28ad74 foo
+
 `hg update`
 
   $ hg up 28ad74