changeset 10229:9df52218810d stable

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.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 11 Jan 2010 21:44:04 +0100
parents 056c366fea8c
children 9f0c7be7c46c 9bf3ebdb19ae
files contrib/shrink-revlog.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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")