[PATCH 3 of 3] Initialize source repository after destination one

Edouard Gomez ed.gomez at free.fr
Wed Jun 13 17:13:54 CDT 2007


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1181772083 -7200
# Node ID d92e16095a167a025949727c40740c87bd159094
# Parent  b055fe1ba41383e3db9541a6beb7497459a8c4d8
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 b055fe1ba413 -r d92e16095a16 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py	Thu Jun 14 00:01:23 2007 +0200
+++ b/hgext/convert/__init__.py	Thu Jun 14 00:01:23 2007 +0200
@@ -265,10 +265,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)
@@ -298,6 +294,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