Patchwork D3452: context: convert to hex for error message only for 20-byte changeid

login
register
mail settings
Submitter phabricator
Date May 7, 2018, 12:54 p.m.
Message ID <4b9b7b6a691399c631a9d3b780252ad2@localhost.localdomain>
Download mbox | patch
Permalink /patch/31298/
State Not Applicable
Headers show

Comments

phabricator - May 7, 2018, 12:54 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9231148ea599: context: convert to hex for error message only for 20-byte changeid (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3452?vs=8469&id=8478

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -10,7 +10,6 @@ 
 import errno
 import filecmp
 import os
-import re
 import stat
 
 from .i18n import _
@@ -51,8 +50,6 @@ 
 
 propertycache = util.propertycache
 
-nonascii = re.compile(br'[^\x21-\x7f]').search
-
 class basectx(object):
     """A basectx object represents the common logic for its children:
     changectx: read-only context that is already present in the repo,
@@ -420,6 +417,7 @@ 
                         and changeid in repo.unfiltered().dirstate.parents()):
                         msg = _("working directory has unknown parent '%s'!")
                         raise error.Abort(msg % short(changeid))
+                    changeid = hex(changeid) # for the error message
 
             elif len(changeid) == 40:
                 try:
@@ -432,11 +430,6 @@ 
                     pass
 
             # lookup failed
-            try:
-                if len(changeid) == 20 and nonascii(changeid):
-                    changeid = hex(changeid)
-            except TypeError:
-                pass
         except (error.FilteredIndexError, error.FilteredLookupError):
             raise error.FilteredRepoLookupError(_("filtered revision '%s'")
                                                 % changeid)