shrink-revlog: avoid cryptic error when used as an extension stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Mon, 11 Jan 2010 21:44:04 +0100
branchstable
changeset 10229 9df52218810d
parent 10228 056c366fea8c
child 10230 9f0c7be7c46c
child 10231 9bf3ebdb19ae
shrink-revlog: avoid cryptic error when used as an extension When shrink-revlog is used as an extension, it would produce an error when switching back to stable because the script will try to execute itself.
contrib/shrink-revlog.py
--- a/contrib/shrink-revlog.py	Mon Jan 11 21:40:19 2010 +0100
+++ b/contrib/shrink-revlog.py	Mon Jan 11 21:44:04 2010 +0100
@@ -212,7 +212,8 @@
           'Running \'hg verify\' is strongly recommended.)\n'
           % (oldindexfn, olddatafn))
 
-try:
-    main()
-except KeyboardInterrupt:
-    sys.exit("interrupted")
+if __name__ == "__main__":
+    try:
+        main()
+    except KeyboardInterrupt:
+        sys.exit("interrupted")