[PATCH] Fix hg cat when the file cannot be found in the specified revision

Mikael Berthe mikael.berthe at lilotux.net
Sat Sep 3 04:51:04 CDT 2005


This patch should fix problems like:
 $ hg cat MANIFESTe.in 04d1ca8ae9ec
(KeyError exception)


# HG changeset patch
# User Mikael Berthe <mikael at lilotux.net>
# Node ID 73e235b6511624822bdc03ad591e992856c72726
# Parent  c165cbf56bb117ebdd226aea950e67b543a665e7
Fix hg cat when the file cannot be found in the specified revision

diff -r c165cbf56bb1 -r 73e235b65116 mercurial/commands.py
--- a/mercurial/commands.py	Thu Sep  1 19:13:56 2005
+++ b/mercurial/commands.py	Sat Sep  3 09:43:21 2005
@@ -559,8 +559,11 @@
             change = repo.changelog.read(n)
             m = repo.manifest.read(change[0])
             n = m[relpath(repo, [file1])[0]]
-        except hg.RepoError, KeyError:
-            n = r.lookup(rev)
+        except (hg.RepoError, KeyError):
+            try:
+                n = r.lookup(rev)
+            except KeyError, inst:
+                raise util.Abort('cannot find file %s in rev %s', file1, rev)
     else:
         n = r.tip()
     fp = make_file(repo, r, opts['output'], node=n)

-- 
MiKael


More information about the Mercurial mailing list