Make distinct lookup error for localrepo.lookup
This allows clone/share to correctly distinguish lookup errors from
corruption errors and catch only the former.
--- a/mercurial/error.py Thu Aug 27 00:00:15 2009 +0200
+++ b/mercurial/error.py Mon Aug 31 10:58:33 2009 -0500
@@ -36,6 +36,9 @@
class RepoError(Exception):
pass
+class RepoLookupError(RepoError):
+ pass
+
class CapabilityError(RepoError):
pass
--- a/mercurial/hg.py Thu Aug 27 00:00:15 2009 +0200
+++ b/mercurial/hg.py Mon Aug 31 10:58:33 2009 -0500
@@ -137,10 +137,12 @@
if update is not True:
checkout = update
for test in (checkout, 'default', 'tip'):
+ if test is None:
+ continue
try:
uprev = r.lookup(test)
break
- except LookupError:
+ except error.RepoLookupError:
continue
_update(r, uprev)
@@ -309,10 +311,12 @@
if update is not True:
checkout = update
for test in (checkout, 'default', 'tip'):
+ if test is None:
+ continue
try:
uprev = dest_repo.lookup(test)
break
- except:
+ except error.RepoLookupError:
continue
_update(dest_repo, uprev)
--- a/mercurial/localrepo.py Thu Aug 27 00:00:15 2009 +0200
+++ b/mercurial/localrepo.py Mon Aug 31 10:58:33 2009 -0500
@@ -509,7 +509,7 @@
key = hex(key)
except:
pass
- raise error.RepoError(_("unknown revision '%s'") % key)
+ raise error.RepoLookupError(_("unknown revision '%s'") % key)
def local(self):
return True