##// END OF EJS Templates
context: don't hex encode all unknown 20 char revision specs (issue4890)...
Mads Kiilerich -
r26604:a3fcc8e3 default
parent child Browse files
Show More
@@ -5,6 +5,8
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 import re
9
8 10 from node import nullid, nullrev, wdirid, short, hex, bin
9 11 from i18n import _
10 12 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
@@ -22,6 +24,8 propertycache = util.propertycache
22 24 # dirty in the working copy.
23 25 _newnode = '!' * 21
24 26
27 nonascii = re.compile(r'[^\x21-\x7f]').search
28
25 29 class basectx(object):
26 30 """A basectx object represents the common logic for its children:
27 31 changectx: read-only context that is already present in the repo,
@@ -466,7 +470,7 class changectx(basectx):
466 470 msg = _("working directory has unknown parent '%s'!")
467 471 raise error.Abort(msg % short(changeid))
468 472 try:
469 if len(changeid) == 20:
473 if len(changeid) == 20 and nonascii(changeid):
470 474 changeid = hex(changeid)
471 475 except TypeError:
472 476 pass
@@ -52,6 +52,18
52 52 $ hg rollback --dry-run --verbose
53 53 repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
54 54
55 Test pull of non-existing 20 character revision specification, making sure plain ascii identifiers
56 not are encoded like a node:
57
58 $ hg pull -r 'xxxxxxxxxxxxxxxxxxxy'
59 pulling from http://foo@localhost:$HGPORT/
60 abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'!
61 [255]
62 $ hg pull -r 'xxxxxxxxxxxxxxxxxx y'
63 pulling from http://foo@localhost:$HGPORT/
64 abort: unknown revision '7878787878787878787878787878787878782079'!
65 [255]
66
55 67 Issue622: hg init && hg pull -u URL doesn't checkout default branch
56 68
57 69 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now