equal
deleted
inserted
replaced
2 # |
2 # |
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
4 # |
4 # |
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 |
|
8 import re |
7 |
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 |
11 import match as matchmod |
13 import match as matchmod |
19 |
21 |
20 # Phony node value to stand-in for new files in some uses of |
22 # Phony node value to stand-in for new files in some uses of |
21 # manifests. Manifests support 21-byte hashes for nodes which are |
23 # manifests. Manifests support 21-byte hashes for nodes which are |
22 # dirty in the working copy. |
24 # dirty in the working copy. |
23 _newnode = '!' * 21 |
25 _newnode = '!' * 21 |
|
26 |
|
27 nonascii = re.compile(r'[^\x21-\x7f]').search |
24 |
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, |
28 workingctx: a context that represents the working directory and can |
32 workingctx: a context that represents the working directory and can |
464 # exception for filtered changeset access |
468 # exception for filtered changeset access |
465 if changeid in repo.unfiltered().dirstate.parents(): |
469 if changeid in repo.unfiltered().dirstate.parents(): |
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 |
473 except (error.FilteredIndexError, error.FilteredLookupError, |
477 except (error.FilteredIndexError, error.FilteredLookupError, |
474 error.FilteredRepoLookupError): |
478 error.FilteredRepoLookupError): |