# HG changeset patch # User Benoit Boissinot # Date 2009-05-17 01:19:00 # Node ID f6c99b1628d76899462c6268f617c153dd3a19e0 # Parent e33baed7c1bc41c777907386e4e435ec6c75f7ad convert: cleanups in monotone converter diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py --- a/hgext/convert/monotone.py +++ b/hgext/convert/monotone.py @@ -93,19 +93,11 @@ class monotone_source(converter_source, 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":"", "date":"", @@ -190,11 +182,8 @@ class monotone_source(converter_source, 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):