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.
--- 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")