hgext/mq.py
changeset 7601 49355875c805
parent 7598 26adfaccdf73
parent 7566 5f7e3f17aece
child 7607 3cf85220a9f9
--- a/hgext/mq.py	Sat Jan 03 17:15:21 2009 +0100
+++ b/hgext/mq.py	Sun Jan 04 21:49:37 2009 +0100
@@ -1190,17 +1190,16 @@
                     patchf.write(chunk)
 
                 try:
-                    copies = {}
-                    for dst in a:
-                        src = repo.dirstate.copied(dst)
-                        # during qfold, the source file for copies may
-                        # be removed. Treat this as a simple add.
-                        if src is not None and src in repo.dirstate:
-                            copies.setdefault(src, []).append(dst)
-                        repo.dirstate.add(dst)
-                    # remember the copies between patchparent and tip
-                    # this may be slow, so don't do it if we're not tracking copies
                     if self.diffopts().git:
+                        copies = {}
+                        for dst in a:
+                            src = repo.dirstate.copied(dst)
+                            # during qfold, the source file for copies may
+                            # be removed. Treat this as a simple add.
+                            if src is not None and src in repo.dirstate:
+                                copies.setdefault(src, []).append(dst)
+                            repo.dirstate.add(dst)
+                        # remember the copies between patchparent and tip
                         for dst in aaa:
                             f = repo.file(dst)
                             src = f.renamed(man[dst])
@@ -1211,9 +1210,15 @@
                             # we can't copy a file created by the patch itself
                             if dst in copies:
                                 del copies[dst]
-                    for src, dsts in copies.iteritems():
-                        for dst in dsts:
-                            repo.dirstate.copy(src, dst)
+                        for src, dsts in copies.iteritems():
+                            for dst in dsts:
+                                repo.dirstate.copy(src, dst)
+                    else:
+                        for dst in a:
+                            repo.dirstate.add(dst)
+                        # Drop useless copy information
+                        for f in list(repo.dirstate.copies()):
+                            repo.dirstate.copy(None, f)
                     for f in r:
                         repo.dirstate.remove(f)
                     # if the patch excludes a modified file, mark that