[PATCH 1 of 8] convert extension: Initialize source repository after destination one

Edouard Gomez ed.gomez at free.fr
Sun Jul 1 17:12:08 CDT 2007


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1183302954 -7200
# Node ID 33e5ead8d98b1d72ea27f27c748c5aa727f80051
# Parent  cf8b8f62688aef733ca6f97f1b8833030da2d63c
convert extension: Initialize source repository after destination one

Because initializing source repository may cost time[1] and because
it's no use initializing the source w/o being sure the destination
may hold the converted changesets, init the source after the
destination.

[1] the upcoming SVN backend

diff -r cf8b8f62688a -r 33e5ead8d98b hgext/convert/__init__.py
--- a/hgext/convert/__init__.py	Mon Jun 25 21:23:24 2007 -0500
+++ b/hgext/convert/__init__.py	Sun Jul 01 17:15:54 2007 +0200
@@ -267,10 +267,6 @@ def _convert(ui, src, dest=None, mapfile
     srcauthor=whatever string you want
     '''
 
-    srcc = converter(ui, src)
-    if not hasattr(srcc, "getcommit"):
-        raise util.Abort("%s: can't read from this repo type" % src)
-
     if not dest:
         dest = src + "-hg"
         ui.status("assuming destination %s\n" % dest)
@@ -300,6 +296,10 @@ def _convert(ui, src, dest=None, mapfile
     if not hasattr(destc, "putcommit"):
         raise util.Abort("%s: can't write to this repo type" % src)
 
+    srcc = converter(ui, src)
+    if not hasattr(srcc, "getcommit"):
+        raise util.Abort("%s: can't read from this repo type" % src)
+
     if not mapfile:
         try:
             mapfile = destc.mapfile()


More information about the Mercurial-devel mailing list