changeset 1098:50a0a36dd48a

manifest: convert sys.stderr bits to AssertionError
author mpm@selenic.com
date Sat, 27 Aug 2005 15:13:52 -0700
parents 1f89ccbab6ce
children 0cb9c72b6c03
files mercurial/manifest.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Sat Aug 27 15:09:46 2005 -0700
+++ b/mercurial/manifest.py	Sat Aug 27 15:13:52 2005 -0700
@@ -43,8 +43,7 @@
         if self.listcache and self.addlist and self.listcache[0] == a:
             d = mdiff.diff(self.listcache[1], self.addlist, 1)
             if mdiff.patch(a, d) != b:
-                sys.stderr.write("*** sortdiff failed, falling back ***\n")
-                return mdiff.textdiff(a, b)
+                raise AssertionError("sortdiff failed!")
             return d
         else:
             return mdiff.textdiff(a, b)
@@ -144,9 +143,8 @@
                     # item not found, insert a new one
                     end = bs
                     if w[1] == 1:
-                        sys.stderr.write("failed to remove %s from manifest\n"
-                                         % f)
-                        sys.exit(1)
+                        raise AssertionError(
+                            "failed to remove %s from manifest\n" % f)
                 else:
                     # item is found, replace/delete the existing line
                     end = bs + 1
@@ -160,8 +158,7 @@
 
         text = "".join(self.addlist)
         if cachedelta and mdiff.patch(self.listcache[0], cachedelta) != text:
-            sys.stderr.write("manifest delta failure\n")
-            sys.exit(1)
+            raise AssertionError("manifest delta failure\n")
         n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
         self.mapcache = (n, map, flags)
         self.listcache = (text, self.addlist)