diff --git a/mercurial/context.py b/mercurial/context.py
index 517ffec37dee4f63afdbec71d513695be19d2649_bWVyY3VyaWFsL2NvbnRleHQucHk=..a3fcc8e3136bd19012d28b863d6bf4429948c573_bWVyY3VyaWFsL2NvbnRleHQucHk= 100644
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -5,6 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
+import re
+
 from node import nullid, nullrev, wdirid, short, hex, bin
 from i18n import _
 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
@@ -22,6 +24,8 @@
 # dirty in the working copy.
 _newnode = '!' * 21
 
+nonascii = re.compile(r'[^\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,
@@ -466,7 +470,7 @@
                 msg = _("working directory has unknown parent '%s'!")
                 raise error.Abort(msg % short(changeid))
             try:
-                if len(changeid) == 20:
+                if len(changeid) == 20 and nonascii(changeid):
                     changeid = hex(changeid)
             except TypeError:
                 pass
diff --git a/tests/test-pull.t b/tests/test-pull.t
index 517ffec37dee4f63afdbec71d513695be19d2649_dGVzdHMvdGVzdC1wdWxsLnQ=..a3fcc8e3136bd19012d28b863d6bf4429948c573_dGVzdHMvdGVzdC1wdWxsLnQ= 100644
--- a/tests/test-pull.t
+++ b/tests/test-pull.t
@@ -52,6 +52,18 @@
   $ hg rollback --dry-run --verbose
   repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
 
+Test pull of non-existing 20 character revision specification, making sure plain ascii identifiers
+not are encoded like a node:
+
+  $ hg pull -r 'xxxxxxxxxxxxxxxxxxxy'
+  pulling from http://foo@localhost:$HGPORT/
+  abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'!
+  [255]
+  $ hg pull -r 'xxxxxxxxxxxxxxxxxx y'
+  pulling from http://foo@localhost:$HGPORT/
+  abort: unknown revision '7878787878787878787878787878787878782079'!
+  [255]
+
 Issue622: hg init && hg pull -u URL doesn't checkout default branch
 
   $ cd ..