changeset 8458:f6c99b1628d7

convert: cleanups in monotone converter
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 17 May 2009 03:19:00 +0200
parents e33baed7c1bc
children 1e63816ce8a2
files hgext/convert/monotone.py
diffstat 1 files changed, 4 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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):