##// 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 # caching against the next repo.status call
989 # caching against the next repo.status call
990 #
990 #
991 mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5]
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 if opts.get('short'):
995 if opts.get('short'):
993 filelist = mm + aa + dd
996 filelist = mm + aa + dd
994 else:
997 else:
@@ -1031,12 +1034,30 b' class queue:'
1031 opts=self.diffopts())
1034 opts=self.diffopts())
1032 patchf.close()
1035 patchf.close()
1033
1036
1034 changes = repo.changelog.read(tip)
1035 repo.dirstate.setparents(*cparents)
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 repo.dirstate.update(a, 'a')
1044 repo.dirstate.update(a, 'a')
1038 for dst, src in copies:
1045 # remember the copies between patchparent and tip
1039 repo.dirstate.copy(src, dst)
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 repo.dirstate.update(r, 'r')
1061 repo.dirstate.update(r, 'r')
1041 # if the patch excludes a modified file, mark that file with mtime=0
1062 # if the patch excludes a modified file, mark that file with mtime=0
1042 # so status can see it.
1063 # so status can see it.
@@ -227,6 +227,9 b' hg up -C 1'
227 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
227 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
228 cat .hg/patches/bar
228 cat .hg/patches/bar
229 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
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 echo
234 echo
232 hg up -C 1
235 hg up -C 1
@@ -238,3 +241,8 b' hg mv baz bleh'
238 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
241 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
239 cat .hg/patches/bar
242 cat .hg/patches/bar
240 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
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 rename from foo
222 rename from foo
223 rename to baz
223 rename to baz
224 2 baz (foo)
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 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
236 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
227 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
237 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -244,3 +254,13 b' new file mode 100644'
244 @@ -0,0 +1,1 @@
254 @@ -0,0 +1,1 @@
245 +bar
255 +bar
246 3 bleh (foo)
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