##// 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 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import re
9
8 from node import nullid, nullrev, wdirid, short, hex, bin
10 from node import nullid, nullrev, wdirid, short, hex, bin
9 from i18n import _
11 from i18n import _
10 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
12 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
@@ -22,6 +24,8 b' propertycache = util.propertycache'
22 # dirty in the working copy.
24 # dirty in the working copy.
23 _newnode = '!' * 21
25 _newnode = '!' * 21
24
26
27 nonascii = re.compile(r'[^\x21-\x7f]').search
28
25 class basectx(object):
29 class basectx(object):
26 """A basectx object represents the common logic for its children:
30 """A basectx object represents the common logic for its children:
27 changectx: read-only context that is already present in the repo,
31 changectx: read-only context that is already present in the repo,
@@ -466,7 +470,7 b' class changectx(basectx):'
466 msg = _("working directory has unknown parent '%s'!")
470 msg = _("working directory has unknown parent '%s'!")
467 raise error.Abort(msg % short(changeid))
471 raise error.Abort(msg % short(changeid))
468 try:
472 try:
469 if len(changeid) == 20:
473 if len(changeid) == 20 and nonascii(changeid):
470 changeid = hex(changeid)
474 changeid = hex(changeid)
471 except TypeError:
475 except TypeError:
472 pass
476 pass
@@ -52,6 +52,18 b''
52 $ hg rollback --dry-run --verbose
52 $ hg rollback --dry-run --verbose
53 repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
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 Issue622: hg init && hg pull -u URL doesn't checkout default branch
67 Issue622: hg init && hg pull -u URL doesn't checkout default branch
56
68
57 $ cd ..
69 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now