changeset 8052:fe2a87a3d344

convert/mtn: allow monotone database files as sources
author Patrick Mezard <pmezard@gmail.com>
date Sat, 11 Apr 2009 23:43:24 +0200
parents 718c8f01feb2
children 027ac8ccfb5b
files hgext/convert/monotone.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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*'