D4042: shortest: use 'x' prefix to disambiguate from revnum if configured

2018-08-04 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa01200b25da6: shortest: use x prefix to 
disambiguate from revnum if configured (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4042?vs=9890=9897

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

AFFECTED FILES
  mercurial/scmutil.py
  tests/test-template-functions.t

CHANGE DETAILS

diff --git a/tests/test-template-functions.t b/tests/test-template-functions.t
--- a/tests/test-template-functions.t
+++ b/tests/test-template-functions.t
@@ -892,6 +892,11 @@
   $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden
   4:107
 
+  $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T 
'{rev}:{shortest(node, 0)}\n'
+  4:x10
+  $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T 
'{rev}:{shortest(node, 0)}\n' --hidden
+  4:x10
+
  node 'c562' should be unique if the other 'c562' nodes are hidden
  (but we don't try the slow path to filter out hidden nodes for now)
 
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -490,6 +490,12 @@
 
 def disambiguate(prefix):
 """Disambiguate against revnums."""
+if repo.ui.configbool('experimental', 'revisions.prefixhexnode'):
+if mayberevnum(repo, prefix):
+return 'x' + prefix
+else:
+return prefix
+
 hexnode = hex(node)
 for length in range(len(prefix), len(hexnode) + 1):
 prefix = hexnode[:length]



To: martinvonz, #hg-reviewers, lothiraldan
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4042: shortest: use 'x' prefix to disambiguate from revnum if configured

2018-08-03 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 9890.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4042?vs=9758=9890

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

AFFECTED FILES
  mercurial/scmutil.py
  tests/test-template-functions.t

CHANGE DETAILS

diff --git a/tests/test-template-functions.t b/tests/test-template-functions.t
--- a/tests/test-template-functions.t
+++ b/tests/test-template-functions.t
@@ -892,6 +892,11 @@
   $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden
   4:107
 
+  $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T 
'{rev}:{shortest(node, 0)}\n'
+  4:x10
+  $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T 
'{rev}:{shortest(node, 0)}\n' --hidden
+  4:x10
+
  node 'c562' should be unique if the other 'c562' nodes are hidden
  (but we don't try the slow path to filter out hidden nodes for now)
 
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -490,6 +490,12 @@
 
 def disambiguate(prefix):
 """Disambiguate against revnums."""
+if repo.ui.configbool('experimental', 'revisions.prefixhexnode'):
+if mayberevnum(repo, prefix):
+return 'x' + prefix
+else:
+return prefix
+
 hexnode = hex(node)
 for length in range(len(prefix), len(hexnode) + 1):
 prefix = hexnode[:length]



To: martinvonz, #hg-reviewers, lothiraldan
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4042: shortest: use 'x' prefix to disambiguate from revnum if configured

2018-08-01 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py
  tests/test-template-functions.t

CHANGE DETAILS

diff --git a/tests/test-template-functions.t b/tests/test-template-functions.t
--- a/tests/test-template-functions.t
+++ b/tests/test-template-functions.t
@@ -892,6 +892,11 @@
   $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden
   4:107
 
+  $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T 
'{rev}:{shortest(node, 0)}\n'
+  4:x10
+  $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T 
'{rev}:{shortest(node, 0)}\n' --hidden
+  4:x10
+
  node 'c562' should be unique if the other 'c562' nodes are hidden
  (but we don't try the slow path to filter out hidden nodes for now)
 
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -486,6 +486,12 @@
 
 def disambiguate(prefix):
 """Disambiguate against revnums."""
+if repo.ui.configbool('experimental', 'revisions.prefixhexnode'):
+if mayberevnum(repo, prefix):
+return 'x' + prefix
+else:
+return prefix
+
 hexnode = hex(node)
 for length in range(len(prefix), len(hexnode) + 1):
 prefix = hexnode[:length]



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel