Commits

anatoly techtonik committed ff05b31

add `hgpullsvn` call on the third step.
successfully converted distutils module. hurray!

  • Participants
  • Parent commits f39feb7

Comments (0)

Files changed (1)

   debug("  retcode: %s" % retcode)
   return retcode
 
+def create_targets_file(modname, sources):
+  """Targets file is passed to 'svn log' command"""
+  tfname = modname+".targets.def"
+  tfpath = os.path.join(savedcwd, tfname)
+  debug('  saving targets list to %s' % tfname)
+  tf = open(tfpath, "w")
+  for src in sources:
+    tf.write(src+"\n")
+  tf.close()
+  return tfpath
+
 
 if __name__ == '__main__':
   cwd = os.path.dirname(__file__) or "."
       #       (dirs should be recheckouted to catch all file changes within)
       # TODO: validate no extra files/dirs are present in working copy
       debug(' creating Mercurial mirror with hgsvn')
-      tfname = modname+".targets.def"
-      tfpath = os.path.join(savedcwd, tfname)
-      debug('  saving targets list to %s' % tfname)
-      tf = open(tfpath, "w")
-      for src in sources:
-        tf.write(src+"\n")
-      tf.close()
+      tfpath = create_targets_file(modname, sources)
 
       debug('  looking for the oldest entry for a given set of files')
       # svn log -v --targets=F -l 1 -r 0:HEAD http://svn.python.org/projects/python/trunk --xml
-      proc = subprocess.Popen("svn log -v --targets=%s -l 1 -r 0:HEAD %s" % (tfpath, repopath),
+      proc = subprocess.Popen('svn log -v --targets="%s" -l 1 -r 0:HEAD %s' % (tfpath, repopath),
                               stdout=subprocess.PIPE, shell=True)
       out = proc.communicate()[0]
       if out == None:
 
     else: # if .svn and .hg structures already exist
       debug(' pulling %s module history into Mercurial' % modname)
-      #ret = call("hgimportsvn --local-only .")
+      tfpath = create_targets_file(modname, sources)
+      ret = call('hgpullsvn --targets="%s"' % tfpath)
       if ret != 0:
         warning("return code %s is not 0, exiting" % ret)
         sys.exit(ret)