Patchwork directaccess: do not abort by 'ff...' hash

login
register
mail settings
Submitter Yuya Nishihara
Date March 24, 2018, 9:48 a.m.
Message ID <3f765e4cbf4c1e53e0fd.1521884920@mimosa>
Download mbox | patch
Permalink /patch/29810/
State Accepted
Headers show

Comments

Yuya Nishihara - March 24, 2018, 9:48 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1521879572 -32400
#      Sat Mar 24 17:19:32 2018 +0900
# Node ID 3f765e4cbf4c1e53e0fd88992c079b321749d837
# Parent  f40b6e7fc011715b209774c0d1fbc5b8a6694401
directaccess: do not abort by 'ff...' hash

Since the 'ff...' hash should never be hidden, we can just ignore it.
Pulkit Goyal - March 24, 2018, 10:53 a.m.
On Sat, Mar 24, 2018 at 3:18 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1521879572 -32400
> #      Sat Mar 24 17:19:32 2018 +0900
> # Node ID 3f765e4cbf4c1e53e0fd88992c079b321749d837
> # Parent  f40b6e7fc011715b209774c0d1fbc5b8a6694401
> directaccess: do not abort by 'ff...' hash
>
> Since the 'ff...' hash should never be hidden, we can just ignore it.

Queued this. Many thanks!

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1419,7 +1419,7 @@  def _getrevsfromsymbols(repo, symbols):
 
         try:
             s = pmatch(s)
-        except error.LookupError:
+        except (error.LookupError, error.WdirUnsupported):
             s = None
 
         if s is not None:
diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t
--- a/tests/test-directaccess.t
+++ b/tests/test-directaccess.t
@@ -179,6 +179,19 @@  This should not throw error
    foo
   -bar
 
+Test special hash/rev
+
+  $ hg log -qr 'null:wdir() & 000000000000'
+  -1:000000000000
+  $ hg log -qr 'null:wdir() & ffffffffffff'
+  2147483647:ffffffffffff
+  $ hg log -qr 'null:wdir() & rev(-1)'
+  -1:000000000000
+  $ hg log -qr 'null:wdir() & rev(2147483647)'
+  2147483647:ffffffffffff
+  $ hg log -qr 'null:wdir() & 2147483647'
+  2147483647:ffffffffffff
+
 Commands with undefined cmdtype should not work right now
 
   $ hg phase -r 28ad74