convert: cleanups in monotone converter
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 17 May 2009 03:19:00 +0200
changeset 8458 f6c99b1628d7
parent 8457 e33baed7c1bc
child 8459 1e63816ce8a2
convert: cleanups in monotone converter
hgext/convert/monotone.py
--- a/hgext/convert/monotone.py	Sun May 17 03:14:37 2009 +0200
+++ b/hgext/convert/monotone.py	Sun May 17 03:19:00 2009 +0200
@@ -93,19 +93,11 @@
     def mtnisfile(self, name, rev):
         # a non-file could be a directory or a deleted or renamed file
         self.mtnloadmanifest(rev)
-        try:
-            self.files[name]
-            return True
-        except KeyError:
-            return False
+        return name in self.files
 
     def mtnisdir(self, name, rev):
         self.mtnloadmanifest(rev)
-        try:
-            self.dirs[name]
-            return True
-        except KeyError:
-            return False
+        return name in self.dirs
 
     def mtngetcerts(self, rev):
         certs = {"author":"<missing>", "date":"<missing>",
@@ -190,11 +182,8 @@
 
     def getmode(self, name, rev):
         self.mtnloadmanifest(rev)
-        try:
-            node, attr = self.files[name]
-            return attr
-        except KeyError:
-            return ""
+        node, attr = self.files.get(name, (None, ""))
+        return attr
 
     def getfile(self, name, rev):
         if not self.mtnisfile(name, rev):