convert/mtn: allow monotone database files as sources
authorPatrick Mezard <pmezard@gmail.com>
Sat, 11 Apr 2009 23:43:24 +0200
changeset 8052 fe2a87a3d344
parent 8051 718c8f01feb2
child 8055 027ac8ccfb5b
convert/mtn: allow monotone database files as sources
hgext/convert/monotone.py
--- a/hgext/convert/monotone.py	Sat Apr 11 23:21:39 2009 +0200
+++ b/hgext/convert/monotone.py	Sat Apr 11 23:43:24 2009 +0200
@@ -16,7 +16,13 @@
 
         norepo = NoRepo (_("%s does not look like a monotone repo") % path)
         if not os.path.exists(os.path.join(path, '_MTN')):
-            raise norepo
+            # Could be a monotone repository (SQLite db file)
+            try:
+                header = file(path, 'rb').read(16)
+            except:
+                header = ''
+            if header != 'SQLite format 3\x00':
+                raise norepo
 
         # regular expressions for parsing monotone output
         space    = r'\s*'