Show More
@@ -1157,7 +1157,7 b' class queue(object):' | |||
|
1157 | 1157 | raise util.Abort(_("patch %s not in series") % patch) |
|
1158 | 1158 | |
|
1159 | 1159 | def push(self, repo, patch=None, force=False, list=False, |
|
1160 | mergeq=None, all=False, move=False, exact=False): | |
|
1160 | mergeq=None, all=False, move=False, exact=False, nobackup=False): | |
|
1161 | 1161 | diffopts = self.diffopts() |
|
1162 | 1162 | wlock = repo.wlock() |
|
1163 | 1163 | try: |
@@ -1257,7 +1257,7 b' class queue(object):' | |||
|
1257 | 1257 | end = self.series.index(patch, start) + 1 |
|
1258 | 1258 | |
|
1259 | 1259 | tobackup = set() |
|
1260 | if force: | |
|
1260 | if not nobackup and force: | |
|
1261 | 1261 | m, a, r, d = self.checklocalchanges(repo, force=True) |
|
1262 | 1262 | tobackup.update(m + a) |
|
1263 | 1263 | |
@@ -1298,7 +1298,8 b' class queue(object):' | |||
|
1298 | 1298 | finally: |
|
1299 | 1299 | wlock.release() |
|
1300 | 1300 | |
|
1301 |
def pop(self, repo, patch=None, force=False, update=True, all=False |
|
|
1301 | def pop(self, repo, patch=None, force=False, update=True, all=False, | |
|
1302 | nobackup=False): | |
|
1302 | 1303 | wlock = repo.wlock() |
|
1303 | 1304 | try: |
|
1304 | 1305 | if patch: |
@@ -1346,7 +1347,8 b' class queue(object):' | |||
|
1346 | 1347 | tobackup = set() |
|
1347 | 1348 | if update: |
|
1348 | 1349 | m, a, r, d = self.checklocalchanges(repo, force=force) |
|
1349 |
|
|
|
1350 | if not nobackup and force: | |
|
1351 | tobackup.update(m + a) | |
|
1350 | 1352 | |
|
1351 | 1353 | self.applieddirty = True |
|
1352 | 1354 | end = len(self.applied) |
@@ -2496,7 +2498,8 b' def fold(ui, repo, *files, **opts):' | |||
|
2496 | 2498 | wlock.release() |
|
2497 | 2499 | |
|
2498 | 2500 | @command("qgoto", |
|
2499 |
[('f', 'force', None, _('overwrite any local changes')) |
|
|
2501 | [('f', 'force', None, _('overwrite any local changes')), | |
|
2502 | ('', 'no-backup', None, _('do not save backup copies of files'))], | |
|
2500 | 2503 | _('hg qgoto [OPTION]... PATCH')) |
|
2501 | 2504 | def goto(ui, repo, patch, **opts): |
|
2502 | 2505 | '''push or pop patches until named patch is at top of stack |
@@ -2504,10 +2507,11 b' def goto(ui, repo, patch, **opts):' | |||
|
2504 | 2507 | Returns 0 on success.''' |
|
2505 | 2508 | q = repo.mq |
|
2506 | 2509 | patch = q.lookup(patch) |
|
2510 | nobackup = opts.get('no_backup') | |
|
2507 | 2511 | if q.isapplied(patch): |
|
2508 | ret = q.pop(repo, patch, force=opts.get('force')) | |
|
2512 | ret = q.pop(repo, patch, force=opts.get('force'), nobackup=nobackup) | |
|
2509 | 2513 | else: |
|
2510 | ret = q.push(repo, patch, force=opts.get('force')) | |
|
2514 | ret = q.push(repo, patch, force=opts.get('force'), nobackup=nobackup) | |
|
2511 | 2515 | q.savedirty() |
|
2512 | 2516 | return ret |
|
2513 | 2517 | |
@@ -2634,7 +2638,9 b' def savename(path):' | |||
|
2634 | 2638 | ('m', 'merge', None, _('merge from another queue (DEPRECATED)')), |
|
2635 | 2639 | ('n', 'name', '', |
|
2636 | 2640 | _('merge queue name (DEPRECATED)'), _('NAME')), |
|
2637 | ('', 'move', None, _('reorder patch series and apply only the patch'))], | |
|
2641 | ('', 'move', None, | |
|
2642 | _('reorder patch series and apply only the patch')), | |
|
2643 | ('', 'no-backup', None, _('do not save backup copies of files'))], | |
|
2638 | 2644 | _('hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]')) |
|
2639 | 2645 | def push(ui, repo, patch=None, **opts): |
|
2640 | 2646 | """push the next patch onto the stack |
@@ -2659,14 +2665,15 b' def push(ui, repo, patch=None, **opts):' | |||
|
2659 | 2665 | ui.warn(_("merging with queue at: %s\n") % mergeq.path) |
|
2660 | 2666 | ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'), |
|
2661 | 2667 | mergeq=mergeq, all=opts.get('all'), move=opts.get('move'), |
|
2662 | exact=opts.get('exact')) | |
|
2668 | exact=opts.get('exact'), nobackup=opts.get('no_backup')) | |
|
2663 | 2669 | return ret |
|
2664 | 2670 | |
|
2665 | 2671 | @command("^qpop", |
|
2666 | 2672 | [('a', 'all', None, _('pop all patches')), |
|
2667 | 2673 | ('n', 'name', '', |
|
2668 | 2674 | _('queue name to pop (DEPRECATED)'), _('NAME')), |
|
2669 |
('f', 'force', None, _('forget any local changes to patched files')) |
|
|
2675 | ('f', 'force', None, _('forget any local changes to patched files')), | |
|
2676 | ('', 'no-backup', None, _('do not save backup copies of files'))], | |
|
2670 | 2677 | _('hg qpop [-a] [-f] [PATCH | INDEX]')) |
|
2671 | 2678 | def pop(ui, repo, patch=None, **opts): |
|
2672 | 2679 | """pop the current patch off the stack |
@@ -2685,7 +2692,7 b' def pop(ui, repo, patch=None, **opts):' | |||
|
2685 | 2692 | else: |
|
2686 | 2693 | q = repo.mq |
|
2687 | 2694 | ret = q.pop(repo, patch, force=opts.get('force'), update=localupdate, |
|
2688 | all=opts.get('all')) | |
|
2695 | all=opts.get('all'), nobackup=opts.get('no_backup')) | |
|
2689 | 2696 | q.savedirty() |
|
2690 | 2697 | return ret |
|
2691 | 2698 |
@@ -220,9 +220,6 b'' | |||
|
220 | 220 | > raise util.Abort(_('qfold cannot fold already applied patch %s') % p) |
|
221 | 221 | warning: line over 80 characters |
|
222 | 222 | hgext/mq.py:0: |
|
223 | > ('', 'move', None, _('reorder patch series and apply only the patch'))], | |
|
224 | warning: line over 80 characters | |
|
225 | hgext/mq.py:0: | |
|
226 | 223 | > ('U', 'noupdate', None, _('do not update the new working directories')), |
|
227 | 224 | warning: line over 80 characters |
|
228 | 225 | hgext/mq.py:0: |
@@ -189,6 +189,19 b' test qpop --force and backup files' | |||
|
189 | 189 | $ cat c.orig |
|
190 | 190 | cc |
|
191 | 191 | |
|
192 | test qpop --force --no-backup | |
|
193 | ||
|
194 | $ hg qpush | |
|
195 | applying p1 | |
|
196 | now at: p1 | |
|
197 | $ rm a.orig | |
|
198 | $ echo a >> a | |
|
199 | $ hg qpop --force --no-backup --verbose | |
|
200 | popping p1 | |
|
201 | patch queue now empty | |
|
202 | $ test -f a.orig && echo 'error: backup with --no-backup' | |
|
203 | [1] | |
|
204 | ||
|
192 | 205 | test qpush --force and backup files |
|
193 | 206 | |
|
194 | 207 | $ echo a >> a |
@@ -237,3 +250,34 b' test qpush --force and backup files' | |||
|
237 | 250 | b1 |
|
238 | 251 | $ cat d.orig |
|
239 | 252 | d1 |
|
253 | ||
|
254 | test qpush --force --no-backup | |
|
255 | ||
|
256 | $ hg revert -qa | |
|
257 | $ hg qpop -a | |
|
258 | popping p3 | |
|
259 | popping p2 | |
|
260 | patch queue now empty | |
|
261 | $ echo a >> a | |
|
262 | $ rm a.orig | |
|
263 | $ hg qpush --force --no-backup --verbose | |
|
264 | applying p2 | |
|
265 | patching file a | |
|
266 | a | |
|
267 | now at: p2 | |
|
268 | $ test -f a.orig && echo 'error: backup with --no-backup' | |
|
269 | [1] | |
|
270 | ||
|
271 | test qgoto --force --no-backup | |
|
272 | ||
|
273 | $ hg qpop | |
|
274 | popping p2 | |
|
275 | patch queue now empty | |
|
276 | $ echo a >> a | |
|
277 | $ hg qgoto --force --no-backup p2 --verbose | |
|
278 | applying p2 | |
|
279 | patching file a | |
|
280 | a | |
|
281 | now at: p2 | |
|
282 | $ test -f a.orig && echo 'error: backup with --no-backup' | |
|
283 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now