diff mercurial/scmutil.py @ 40403:bf249bb60087

shortest: never emit 0-length prefix even if unique It turned out that the pure version of our code for finding the shortest unique nodeid prefix would return a 0-length string if that was unique (because there was at most one revision in the disambiguation set). That's kind of correct, but it can't be used as input, so we shouldn't return it. Let's just adjust the given minlength up to at least 1. This fixes test-template-functions.t, which was failing in pure mode. Differential Revision: https://phab.mercurial-scm.org/D5181
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 22 Oct 2018 11:34:35 -0700
parents 824b687ff6af
children 597bb5a6867f
line wrap: on
line diff
--- a/mercurial/scmutil.py	Mon Oct 22 15:51:01 2018 +0200
+++ b/mercurial/scmutil.py	Mon Oct 22 11:34:35 2018 -0700
@@ -495,6 +495,8 @@
     # which would be unacceptably slow. so we look for hash collision in
     # unfiltered space, which means some hashes may be slightly longer.
 
+    minlength=max(minlength, 1)
+
     def disambiguate(prefix):
         """Disambiguate against revnums."""
         if repo.ui.configbool('experimental', 'revisions.prefixhexnode'):