##// END OF EJS Templates
qrefresh: fix handling of copies in the fast path
Alexis S. L. Carvalho -
r3700:4c158de5 default
parent child Browse files
Show More
@@ -989,6 +989,9 b' class queue:'
989 989 # caching against the next repo.status call
990 990 #
991 991 mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5]
992 changes = repo.changelog.read(tip)
993 man = repo.manifest.read(changes[0])
994 aaa = aa[:]
992 995 if opts.get('short'):
993 996 filelist = mm + aa + dd
994 997 else:
@@ -1031,12 +1034,30 b' class queue:'
1031 1034 opts=self.diffopts())
1032 1035 patchf.close()
1033 1036
1034 changes = repo.changelog.read(tip)
1035 1037 repo.dirstate.setparents(*cparents)
1036 copies = [(f, repo.dirstate.copied(f)) for f in a]
1038 copies = {}
1039 for dst in a:
1040 src = repo.dirstate.copied(dst)
1041 if src is None:
1042 continue
1043 copies.setdefault(src, []).append(dst)
1037 1044 repo.dirstate.update(a, 'a')
1038 for dst, src in copies:
1039 repo.dirstate.copy(src, dst)
1045 # remember the copies between patchparent and tip
1046 # this may be slow, so don't do it if we're not tracking copies
1047 if self.diffopts().git:
1048 for dst in aaa:
1049 f = repo.file(dst)
1050 src = f.renamed(man[dst])
1051 if src:
1052 copies[src[0]] = copies.get(dst, [])
1053 if dst in a:
1054 copies[src[0]].append(dst)
1055 # we can't copy a file created by the patch itself
1056 if dst in copies:
1057 del copies[dst]
1058 for src, dsts in copies.iteritems():
1059 for dst in dsts:
1060 repo.dirstate.copy(src, dst)
1040 1061 repo.dirstate.update(r, 'r')
1041 1062 # if the patch excludes a modified file, mark that file with mtime=0
1042 1063 # so status can see it.
@@ -227,6 +227,9 b' hg up -C 1'
227 227 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
228 228 cat .hg/patches/bar
229 229 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
230 hg qrefresh --git
231 cat .hg/patches/bar
232 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
230 233
231 234 echo
232 235 hg up -C 1
@@ -238,3 +241,8 b' hg mv baz bleh'
238 241 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
239 242 cat .hg/patches/bar
240 243 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
244 hg mv quux fred
245 hg mv bleh barney
246 hg qrefresh --git
247 cat .hg/patches/bar
248 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
@@ -222,6 +222,16 b' diff --git a/foo b/baz'
222 222 rename from foo
223 223 rename to baz
224 224 2 baz (foo)
225 diff --git a/bar b/bar
226 new file mode 100644
227 --- /dev/null
228 +++ b/bar
229 @@ -0,0 +1,1 @@
230 +bar
231 diff --git a/foo b/baz
232 rename from foo
233 rename to baz
234 2 baz (foo)
225 235
226 236 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
227 237 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -244,3 +254,13 b' new file mode 100644'
244 254 @@ -0,0 +1,1 @@
245 255 +bar
246 256 3 bleh (foo)
257 diff --git a/foo b/barney
258 rename from foo
259 rename to barney
260 diff --git a/fred b/fred
261 new file mode 100644
262 --- /dev/null
263 +++ b/fred
264 @@ -0,0 +1,1 @@
265 +bar
266 3 barney (foo)
General Comments 0
You need to be logged in to leave comments. Login now