diff hgext/convert/convcmd.py @ 6716:c9b8d2565b92

convert: reintegrate file retrieval code in sinks It simplifies the sink interface and all the sinks to handle files data as they want.
author Patrick Mezard <pmezard@gmail.com>
date Thu, 19 Jun 2008 00:14:24 +0200
parents 950e72fc7cf3
children 580d5e6bfc1f
line wrap: on
line diff
--- a/hgext/convert/convcmd.py	Thu Jun 19 00:14:23 2008 +0200
+++ b/hgext/convert/convcmd.py	Thu Jun 19 00:14:24 2008 +0200
@@ -221,8 +221,6 @@
 
     def copy(self, rev):
         commit = self.commitcache[rev]
-        do_copies = hasattr(self.dest, 'copyfile')
-        filenames = []
 
         changes = self.source.getchanges(rev)
         if isinstance(changes, basestring):
@@ -241,21 +239,6 @@
                 pbranches.append((self.map[prev],
                                   self.commitcache[prev].branch))
         self.dest.setbranch(commit.branch, pbranches)
-        for f, v in files:
-            filenames.append(f)
-            try:
-                data = self.source.getfile(f, v)
-            except IOError, inst:
-                self.dest.delfile(f)
-            else:
-                e = self.source.getmode(f, v)
-                self.dest.putfile(f, e, data)
-                if do_copies:
-                    if f in copies:
-                        copyf = copies[f]
-                        # Merely marks that a copy happened.
-                        self.dest.copyfile(copyf, f)
-
         try:
             parents = self.splicemap[rev].replace(',', ' ').split()
             self.ui.status('spliced in %s as parents of %s\n' %
@@ -263,7 +246,7 @@
             parents = [self.map.get(p, p) for p in parents]
         except KeyError:
             parents = [b[0] for b in pbranches]
-        newnode = self.dest.putcommit(filenames, parents, commit)
+        newnode = self.dest.putcommit(files, copies, parents, commit, self.source)
         self.source.converted(rev, newnode)
         self.map[rev] = newnode