##// END OF EJS Templates
Merge with crew-stable
Patrick Mezard -
r10368:f05e0d54 merge default
parent child Browse files
Show More
@@ -1208,12 +1208,14 b' class queue(object):'
1208 1208 if newdate:
1209 1209 newdate = '%d %d' % util.parsedate(newdate)
1210 1210 wlock = repo.wlock()
1211
1211 1212 try:
1212 1213 self.check_toppatch(repo)
1213 1214 (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name)
1214 1215 top = bin(top)
1215 1216 if repo.changelog.heads(top) != [top]:
1216 1217 raise util.Abort(_("cannot refresh a revision with children"))
1218
1217 1219 cparents = repo.changelog.parents(top)
1218 1220 patchparent = self.qparents(repo, top)
1219 1221 ph = patchheader(self.join(patchfn))
@@ -1232,27 +1234,20 b' class queue(object):'
1232 1234 if comments:
1233 1235 patchf.write(comments)
1234 1236
1235 tip = repo.changelog.tip()
1236 if top == tip:
1237 # if the top of our patch queue is also the tip, there is an
1238 # optimization here. We update the dirstate in place and strip
1239 # off the tip commit. Then just commit the current directory
1240 # tree. We can also send repo.commit the list of files
1241 # changed to speed up the diff
1242 #
1243 # in short mode, we only diff the files included in the
1244 # patch already plus specified files
1237 # update the dirstate in place, strip off the qtip commit
1238 # and then commit.
1245 1239 #
1246 1240 # this should really read:
1247 1241 # mm, dd, aa, aa2 = repo.status(tip, patchparent)[:4]
1248 1242 # but we do it backwards to take advantage of manifest/chlog
1249 1243 # caching against the next repo.status call
1250 #
1251 mm, aa, dd, aa2 = repo.status(patchparent, tip)[:4]
1252 changes = repo.changelog.read(tip)
1244 mm, aa, dd, aa2 = repo.status(patchparent, top)[:4]
1245 changes = repo.changelog.read(top)
1253 1246 man = repo.manifest.read(changes[0])
1254 1247 aaa = aa[:]
1255 1248 matchfn = cmdutil.match(repo, pats, opts)
1249 # in short mode, we only diff the files included in the
1250 # patch already plus specified files
1256 1251 if opts.get('short'):
1257 1252 # if amending a patch, we start with existing
1258 1253 # files plus specified files - unfiltered
@@ -1264,7 +1259,7 b' class queue(object):'
1264 1259 m, a, r, d = repo.status(match=match)[:4]
1265 1260
1266 1261 # we might end up with files that were added between
1267 # tip and the dirstate parent, but then changed in the
1262 # qtip and the dirstate parent, but then changed in the
1268 1263 # local dirstate. in this case, we want them to only
1269 1264 # show up in the added section
1270 1265 for x in m:
@@ -1311,7 +1306,7 b' class queue(object):'
1311 1306 if src is not None and src in repo.dirstate:
1312 1307 copies.setdefault(src, []).append(dst)
1313 1308 repo.dirstate.add(dst)
1314 # remember the copies between patchparent and tip
1309 # remember the copies between patchparent and qtip
1315 1310 for dst in aaa:
1316 1311 f = repo.file(dst)
1317 1312 src = f.renamed(man[dst])
@@ -1381,24 +1376,6 b' class queue(object):'
1381 1376 self.ui.warn(_('refresh interrupted while patch was popped! '
1382 1377 '(revert --all, qpush to recover)\n'))
1383 1378 raise
1384 else:
1385 self.printdiff(repo, diffopts, patchparent, fp=patchf)
1386 patchf.rename()
1387 added = repo.status()[1]
1388 for a in added:
1389 f = repo.wjoin(a)
1390 try:
1391 os.unlink(f)
1392 except OSError, e:
1393 if e.errno != errno.ENOENT:
1394 raise
1395 try: os.removedirs(os.path.dirname(f))
1396 except: pass
1397 # forget the file copies in the dirstate
1398 # push should readd the files later on
1399 repo.dirstate.forget(a)
1400 self.pop(repo, force=True)
1401 self.push(repo, force=True)
1402 1379 finally:
1403 1380 wlock.release()
1404 1381 self.removeundo(repo)
@@ -155,6 +155,31 b' hg qrefresh'
155 155 hg qdiff --nodates
156 156 cd ..
157 157
158 echo '% issue2025: qrefresh does not honor filtering options when tip != qtip'
159 hg init repo-2025
160 cd repo-2025
161 echo a > a
162 echo b > b
163 hg ci -qAm addab
164 echo a >> a
165 echo b >> b
166 hg qnew -f patch
167 hg up -qC 0
168 echo c > c
169 hg ci -qAm addc
170 hg up -qC 1
171 echo '% refresh with tip != qtip'
172 hg --config diff.nodates=1 qrefresh -I b 2>&1 \
173 | sed 's/saving bundle.*/saving bundle.../g'
174 echo '% status after refresh'
175 hg st
176 echo '% b after refresh'
177 cat b
178 echo '% patch file after refresh'
179 cat .hg/patches/patch
180 cd ..
181
182
158 183 echo % issue1441 with git patches
159 184 hg init repo-1441-git
160 185 cd repo-1441-git
@@ -259,6 +259,26 b' diff -r 000000000000 b'
259 259 +++ b/b
260 260 @@ -0,0 +1,1 @@
261 261 +a
262 % issue2025: qrefresh does not honor filtering options when tip != qtip
263 % refresh with tip != qtip
264 saving bundle...
265 adding branch
266 adding changesets
267 adding manifests
268 adding file changes
269 added 1 changesets with 1 changes to 1 files
270 % status after refresh
271 M a
272 % b after refresh
273 b
274 b
275 % patch file after refresh
276 diff -r 1a60229be7ac b
277 --- a/b
278 +++ b/b
279 @@ -1,1 +1,2 @@
280 b
281 +b
262 282 % issue1441 with git patches
263 283 diff --git a/b b/b
264 284 new file mode 100644
@@ -392,16 +392,11 b' copy to copy'
392 392 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
393 393 created new head
394 394 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
395 popping bar
396 395 adding branch
397 396 adding changesets
398 397 adding manifests
399 398 adding file changes
400 399 added 1 changesets with 1 changes to 1 files
401 patch queue now empty
402 (working directory not at a head)
403 applying bar
404 now at: bar
405 400 diff --git a/bar b/bar
406 401 new file mode 100644
407 402 --- /dev/null
@@ -427,16 +422,11 b' diff --git a/foo b/baz'
427 422 % test file move chains in the slow path
428 423 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
429 424 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
430 popping bar
431 425 adding branch
432 426 adding changesets
433 427 adding manifests
434 428 adding file changes
435 429 added 1 changesets with 1 changes to 1 files
436 patch queue now empty
437 (working directory not at a head)
438 applying bar
439 now at: bar
440 430 diff --git a/foo b/bleh
441 431 rename from foo
442 432 rename to bleh
General Comments 0
You need to be logged in to leave comments. Login now