Show More
@@ -552,7 +552,8 b' def overriderevert(orig, ui, repo, *pats' | |||||
552 | for lfile in modified: |
|
552 | for lfile in modified: | |
553 | lfutil.updatestandin(repo, lfutil.standin(lfile)) |
|
553 | lfutil.updatestandin(repo, lfutil.standin(lfile)) | |
554 | for lfile in missing: |
|
554 | for lfile in missing: | |
555 |
os. |
|
555 | if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))): | |
|
556 | os.unlink(repo.wjoin(lfutil.standin(lfile))) | |||
556 |
|
557 | |||
557 | try: |
|
558 | try: | |
558 | ctx = repo[opts.get('rev')] |
|
559 | ctx = repo[opts.get('rev')] | |
@@ -953,6 +954,8 b' def overridesummary(orig, ui, repo, *pat' | |||||
953 | ui.status(_('largefiles: %d to upload\n') % len(toupload)) |
|
954 | ui.status(_('largefiles: %d to upload\n') % len(toupload)) | |
954 |
|
955 | |||
955 | def overrideaddremove(orig, ui, repo, *pats, **opts): |
|
956 | def overrideaddremove(orig, ui, repo, *pats, **opts): | |
|
957 | if not lfutil.islfilesrepo(repo): | |||
|
958 | return orig(ui, repo, *pats, **opts) | |||
956 | # Get the list of missing largefiles so we can remove them |
|
959 | # Get the list of missing largefiles so we can remove them | |
957 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
960 | lfdirstate = lfutil.openlfdirstate(ui, repo) | |
958 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, |
|
961 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, |
@@ -554,6 +554,18 b' class queue(object):' | |||||
554 | except OSError, inst: |
|
554 | except OSError, inst: | |
555 | self.ui.warn(_('error removing undo: %s\n') % str(inst)) |
|
555 | self.ui.warn(_('error removing undo: %s\n') % str(inst)) | |
556 |
|
556 | |||
|
557 | def backup(self, repo, files, copy=False): | |||
|
558 | # backup local changes in --force case | |||
|
559 | for f in sorted(files): | |||
|
560 | absf = repo.wjoin(f) | |||
|
561 | if os.path.lexists(absf): | |||
|
562 | self.ui.note(_('saving current version of %s as %s\n') % | |||
|
563 | (f, f + '.orig')) | |||
|
564 | if copy: | |||
|
565 | util.copyfile(absf, absf + '.orig') | |||
|
566 | else: | |||
|
567 | util.rename(absf, absf + '.orig') | |||
|
568 | ||||
557 | def printdiff(self, repo, diffopts, node1, node2=None, files=None, |
|
569 | def printdiff(self, repo, diffopts, node1, node2=None, files=None, | |
558 | fp=None, changes=None, opts={}): |
|
570 | fp=None, changes=None, opts={}): | |
559 | stat = opts.get('stat') |
|
571 | stat = opts.get('stat') | |
@@ -668,7 +680,8 b' class queue(object):' | |||||
668 | return (False, list(files), False) |
|
680 | return (False, list(files), False) | |
669 |
|
681 | |||
670 | def apply(self, repo, series, list=False, update_status=True, |
|
682 | def apply(self, repo, series, list=False, update_status=True, | |
671 |
strict=False, patchdir=None, merge=None, all_files=None |
|
683 | strict=False, patchdir=None, merge=None, all_files=None, | |
|
684 | tobackup=None): | |||
672 | wlock = lock = tr = None |
|
685 | wlock = lock = tr = None | |
673 | try: |
|
686 | try: | |
674 | wlock = repo.wlock() |
|
687 | wlock = repo.wlock() | |
@@ -676,7 +689,8 b' class queue(object):' | |||||
676 | tr = repo.transaction("qpush") |
|
689 | tr = repo.transaction("qpush") | |
677 | try: |
|
690 | try: | |
678 | ret = self._apply(repo, series, list, update_status, |
|
691 | ret = self._apply(repo, series, list, update_status, | |
679 |
strict, patchdir, merge, all_files=all_files |
|
692 | strict, patchdir, merge, all_files=all_files, | |
|
693 | tobackup=tobackup) | |||
680 | tr.close() |
|
694 | tr.close() | |
681 | self.savedirty() |
|
695 | self.savedirty() | |
682 | return ret |
|
696 | return ret | |
@@ -693,9 +707,14 b' class queue(object):' | |||||
693 | self.removeundo(repo) |
|
707 | self.removeundo(repo) | |
694 |
|
708 | |||
695 | def _apply(self, repo, series, list=False, update_status=True, |
|
709 | def _apply(self, repo, series, list=False, update_status=True, | |
696 |
strict=False, patchdir=None, merge=None, all_files=None |
|
710 | strict=False, patchdir=None, merge=None, all_files=None, | |
697 | '''returns (error, hash) |
|
711 | tobackup=None): | |
698 | error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz''' |
|
712 | """returns (error, hash) | |
|
713 | ||||
|
714 | error = 1 for unable to read, 2 for patch failed, 3 for patch | |||
|
715 | fuzz. tobackup is None or a set of files to backup before they | |||
|
716 | are modified by a patch. | |||
|
717 | """ | |||
699 | # TODO unify with commands.py |
|
718 | # TODO unify with commands.py | |
700 | if not patchdir: |
|
719 | if not patchdir: | |
701 | patchdir = self.path |
|
720 | patchdir = self.path | |
@@ -727,6 +746,11 b' class queue(object):' | |||||
727 | message = '\n'.join(message) |
|
746 | message = '\n'.join(message) | |
728 |
|
747 | |||
729 | if ph.haspatch: |
|
748 | if ph.haspatch: | |
|
749 | if tobackup: | |||
|
750 | touched = patchmod.changedfiles(self.ui, repo, pf) | |||
|
751 | touched = set(touched) & tobackup | |||
|
752 | self.backup(repo, touched, copy=True) | |||
|
753 | tobackup = tobackup - touched | |||
730 | (patcherr, files, fuzz) = self.patch(repo, pf) |
|
754 | (patcherr, files, fuzz) = self.patch(repo, pf) | |
731 | if all_files is not None: |
|
755 | if all_files is not None: | |
732 | all_files.update(files) |
|
756 | all_files.update(files) | |
@@ -1133,7 +1157,7 b' class queue(object):' | |||||
1133 | raise util.Abort(_("patch %s not in series") % patch) |
|
1157 | raise util.Abort(_("patch %s not in series") % patch) | |
1134 |
|
1158 | |||
1135 | def push(self, repo, patch=None, force=False, list=False, |
|
1159 | def push(self, repo, patch=None, force=False, list=False, | |
1136 | mergeq=None, all=False, move=False, exact=False): |
|
1160 | mergeq=None, all=False, move=False, exact=False, nobackup=False): | |
1137 | diffopts = self.diffopts() |
|
1161 | diffopts = self.diffopts() | |
1138 | wlock = repo.wlock() |
|
1162 | wlock = repo.wlock() | |
1139 | try: |
|
1163 | try: | |
@@ -1232,13 +1256,19 b' class queue(object):' | |||||
1232 | else: |
|
1256 | else: | |
1233 | end = self.series.index(patch, start) + 1 |
|
1257 | end = self.series.index(patch, start) + 1 | |
1234 |
|
1258 | |||
|
1259 | tobackup = set() | |||
|
1260 | if not nobackup and force: | |||
|
1261 | m, a, r, d = self.checklocalchanges(repo, force=True) | |||
|
1262 | tobackup.update(m + a) | |||
|
1263 | ||||
1235 | s = self.series[start:end] |
|
1264 | s = self.series[start:end] | |
1236 | all_files = set() |
|
1265 | all_files = set() | |
1237 | try: |
|
1266 | try: | |
1238 | if mergeq: |
|
1267 | if mergeq: | |
1239 | ret = self.mergepatch(repo, mergeq, s, diffopts) |
|
1268 | ret = self.mergepatch(repo, mergeq, s, diffopts) | |
1240 | else: |
|
1269 | else: | |
1241 |
ret = self.apply(repo, s, list, all_files=all_files |
|
1270 | ret = self.apply(repo, s, list, all_files=all_files, | |
|
1271 | tobackup=tobackup) | |||
1242 | except: |
|
1272 | except: | |
1243 | self.ui.warn(_('cleaning up working directory...')) |
|
1273 | self.ui.warn(_('cleaning up working directory...')) | |
1244 | node = repo.dirstate.p1() |
|
1274 | node = repo.dirstate.p1() | |
@@ -1268,7 +1298,8 b' class queue(object):' | |||||
1268 | finally: |
|
1298 | finally: | |
1269 | wlock.release() |
|
1299 | wlock.release() | |
1270 |
|
1300 | |||
1271 |
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): | |||
1272 | wlock = repo.wlock() |
|
1303 | wlock = repo.wlock() | |
1273 | try: |
|
1304 | try: | |
1274 | if patch: |
|
1305 | if patch: | |
@@ -1313,8 +1344,11 b' class queue(object):' | |||||
1313 | break |
|
1344 | break | |
1314 | update = needupdate |
|
1345 | update = needupdate | |
1315 |
|
1346 | |||
1316 | if not force and update: |
|
1347 | tobackup = set() | |
1317 | self.checklocalchanges(repo) |
|
1348 | if update: | |
|
1349 | m, a, r, d = self.checklocalchanges(repo, force=force) | |||
|
1350 | if not nobackup and force: | |||
|
1351 | tobackup.update(m + a) | |||
1318 |
|
1352 | |||
1319 | self.applieddirty = True |
|
1353 | self.applieddirty = True | |
1320 | end = len(self.applied) |
|
1354 | end = len(self.applied) | |
@@ -1344,6 +1378,10 b' class queue(object):' | |||||
1344 | m, a, r, d = repo.status(qp, top)[:4] |
|
1378 | m, a, r, d = repo.status(qp, top)[:4] | |
1345 | if d: |
|
1379 | if d: | |
1346 | raise util.Abort(_("deletions found between repo revs")) |
|
1380 | raise util.Abort(_("deletions found between repo revs")) | |
|
1381 | ||||
|
1382 | # backup local changes in --force case | |||
|
1383 | self.backup(repo, set(a + m + r) & tobackup) | |||
|
1384 | ||||
1347 | for f in a: |
|
1385 | for f in a: | |
1348 | try: |
|
1386 | try: | |
1349 | util.unlinkpath(repo.wjoin(f)) |
|
1387 | util.unlinkpath(repo.wjoin(f)) | |
@@ -2460,7 +2498,8 b' def fold(ui, repo, *files, **opts):' | |||||
2460 | wlock.release() |
|
2498 | wlock.release() | |
2461 |
|
2499 | |||
2462 | @command("qgoto", |
|
2500 | @command("qgoto", | |
2463 |
[('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'))], | |||
2464 | _('hg qgoto [OPTION]... PATCH')) |
|
2503 | _('hg qgoto [OPTION]... PATCH')) | |
2465 | def goto(ui, repo, patch, **opts): |
|
2504 | def goto(ui, repo, patch, **opts): | |
2466 | '''push or pop patches until named patch is at top of stack |
|
2505 | '''push or pop patches until named patch is at top of stack | |
@@ -2468,10 +2507,11 b' def goto(ui, repo, patch, **opts):' | |||||
2468 | Returns 0 on success.''' |
|
2507 | Returns 0 on success.''' | |
2469 | q = repo.mq |
|
2508 | q = repo.mq | |
2470 | patch = q.lookup(patch) |
|
2509 | patch = q.lookup(patch) | |
|
2510 | nobackup = opts.get('no_backup') | |||
2471 | if q.isapplied(patch): |
|
2511 | if q.isapplied(patch): | |
2472 | ret = q.pop(repo, patch, force=opts.get('force')) |
|
2512 | ret = q.pop(repo, patch, force=opts.get('force'), nobackup=nobackup) | |
2473 | else: |
|
2513 | else: | |
2474 | ret = q.push(repo, patch, force=opts.get('force')) |
|
2514 | ret = q.push(repo, patch, force=opts.get('force'), nobackup=nobackup) | |
2475 | q.savedirty() |
|
2515 | q.savedirty() | |
2476 | return ret |
|
2516 | return ret | |
2477 |
|
2517 | |||
@@ -2598,7 +2638,9 b' def savename(path):' | |||||
2598 | ('m', 'merge', None, _('merge from another queue (DEPRECATED)')), |
|
2638 | ('m', 'merge', None, _('merge from another queue (DEPRECATED)')), | |
2599 | ('n', 'name', '', |
|
2639 | ('n', 'name', '', | |
2600 | _('merge queue name (DEPRECATED)'), _('NAME')), |
|
2640 | _('merge queue name (DEPRECATED)'), _('NAME')), | |
2601 | ('', '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'))], | |||
2602 | _('hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]')) |
|
2644 | _('hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]')) | |
2603 | def push(ui, repo, patch=None, **opts): |
|
2645 | def push(ui, repo, patch=None, **opts): | |
2604 | """push the next patch onto the stack |
|
2646 | """push the next patch onto the stack | |
@@ -2623,14 +2665,15 b' def push(ui, repo, patch=None, **opts):' | |||||
2623 | ui.warn(_("merging with queue at: %s\n") % mergeq.path) |
|
2665 | ui.warn(_("merging with queue at: %s\n") % mergeq.path) | |
2624 | ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'), |
|
2666 | ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'), | |
2625 | mergeq=mergeq, all=opts.get('all'), move=opts.get('move'), |
|
2667 | mergeq=mergeq, all=opts.get('all'), move=opts.get('move'), | |
2626 | exact=opts.get('exact')) |
|
2668 | exact=opts.get('exact'), nobackup=opts.get('no_backup')) | |
2627 | return ret |
|
2669 | return ret | |
2628 |
|
2670 | |||
2629 | @command("^qpop", |
|
2671 | @command("^qpop", | |
2630 | [('a', 'all', None, _('pop all patches')), |
|
2672 | [('a', 'all', None, _('pop all patches')), | |
2631 | ('n', 'name', '', |
|
2673 | ('n', 'name', '', | |
2632 | _('queue name to pop (DEPRECATED)'), _('NAME')), |
|
2674 | _('queue name to pop (DEPRECATED)'), _('NAME')), | |
2633 |
('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'))], | |||
2634 | _('hg qpop [-a] [-f] [PATCH | INDEX]')) |
|
2677 | _('hg qpop [-a] [-f] [PATCH | INDEX]')) | |
2635 | def pop(ui, repo, patch=None, **opts): |
|
2678 | def pop(ui, repo, patch=None, **opts): | |
2636 | """pop the current patch off the stack |
|
2679 | """pop the current patch off the stack | |
@@ -2649,7 +2692,7 b' def pop(ui, repo, patch=None, **opts):' | |||||
2649 | else: |
|
2692 | else: | |
2650 | q = repo.mq |
|
2693 | q = repo.mq | |
2651 | ret = q.pop(repo, patch, force=opts.get('force'), update=localupdate, |
|
2694 | ret = q.pop(repo, patch, force=opts.get('force'), update=localupdate, | |
2652 | all=opts.get('all')) |
|
2695 | all=opts.get('all'), nobackup=opts.get('no_backup')) | |
2653 | q.savedirty() |
|
2696 | q.savedirty() | |
2654 | return ret |
|
2697 | return ret | |
2655 |
|
2698 |
@@ -22,12 +22,6 b' To set the pager that should be used, se' | |||||
22 | If no pager is set, the pager extensions uses the environment variable |
|
22 | If no pager is set, the pager extensions uses the environment variable | |
23 | $PAGER. If neither pager.pager, nor $PAGER is set, no pager is used. |
|
23 | $PAGER. If neither pager.pager, nor $PAGER is set, no pager is used. | |
24 |
|
24 | |||
25 | If you notice "BROKEN PIPE" error messages, you can disable them by |
|
|||
26 | setting:: |
|
|||
27 |
|
||||
28 | [pager] |
|
|||
29 | quiet = True |
|
|||
30 |
|
||||
31 | You can disable the pager for certain commands by adding them to the |
|
25 | You can disable the pager for certain commands by adding them to the | |
32 | pager.ignore list:: |
|
26 | pager.ignore list:: | |
33 |
|
27 | |||
@@ -53,37 +47,27 b' used. Use a boolean value like yes, no, ' | |||||
53 | normal behavior. |
|
47 | normal behavior. | |
54 | ''' |
|
48 | ''' | |
55 |
|
49 | |||
56 |
import sys, os, signal, s |
|
50 | import atexit, sys, os, signal, subprocess | |
57 | from mercurial import commands, dispatch, util, extensions |
|
51 | from mercurial import commands, dispatch, util, extensions | |
58 | from mercurial.i18n import _ |
|
52 | from mercurial.i18n import _ | |
59 |
|
53 | |||
60 | def _runpager(p): |
|
54 | def _runpager(p): | |
61 | if not util.safehasattr(os, 'fork'): |
|
55 | pager = subprocess.Popen(p, shell=True, bufsize=-1, | |
62 | sys.stdout = util.popen(p, 'wb') |
|
56 | close_fds=util.closefds, stdin=subprocess.PIPE, | |
63 | if util.isatty(sys.stderr): |
|
57 | stdout=sys.stdout, stderr=sys.stderr) | |
64 | sys.stderr = sys.stdout |
|
58 | ||
65 | return |
|
59 | stdout = os.dup(sys.stdout.fileno()) | |
66 | fdin, fdout = os.pipe() |
|
60 | stderr = os.dup(sys.stderr.fileno()) | |
67 | pid = os.fork() |
|
61 | os.dup2(pager.stdin.fileno(), sys.stdout.fileno()) | |
68 | if pid == 0: |
|
62 | if util.isatty(sys.stderr): | |
69 | os.close(fdin) |
|
63 | os.dup2(pager.stdin.fileno(), sys.stderr.fileno()) | |
70 | os.dup2(fdout, sys.stdout.fileno()) |
|
64 | ||
71 | if util.isatty(sys.stderr): |
|
65 | @atexit.register | |
72 | os.dup2(fdout, sys.stderr.fileno()) |
|
66 | def killpager(): | |
73 |
|
|
67 | pager.stdin.close() | |
74 | return |
|
68 | os.dup2(stdout, sys.stdout.fileno()) | |
75 |
os.dup2( |
|
69 | os.dup2(stderr, sys.stderr.fileno()) | |
76 | os.close(fdin) |
|
70 | pager.wait() | |
77 | os.close(fdout) |
|
|||
78 | try: |
|
|||
79 | os.execvp('/bin/sh', ['/bin/sh', '-c', p]) |
|
|||
80 | except OSError, e: |
|
|||
81 | if e.errno == errno.ENOENT: |
|
|||
82 | # no /bin/sh, try executing the pager directly |
|
|||
83 | args = shlex.split(p) |
|
|||
84 | os.execvp(args[0], args) |
|
|||
85 | else: |
|
|||
86 | raise |
|
|||
87 |
|
71 | |||
88 | def uisetup(ui): |
|
72 | def uisetup(ui): | |
89 | if ui.plain() or '--debugger' in sys.argv or not util.isatty(sys.stdout): |
|
73 | if ui.plain() or '--debugger' in sys.argv or not util.isatty(sys.stdout): | |
@@ -101,9 +85,11 b' def uisetup(ui):' | |||||
101 | (cmd not in ui.configlist('pager', 'ignore') and not attend))): |
|
85 | (cmd not in ui.configlist('pager', 'ignore') and not attend))): | |
102 | ui.setconfig('ui', 'formatted', ui.formatted()) |
|
86 | ui.setconfig('ui', 'formatted', ui.formatted()) | |
103 | ui.setconfig('ui', 'interactive', False) |
|
87 | ui.setconfig('ui', 'interactive', False) | |
|
88 | try: | |||
|
89 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | |||
|
90 | except ValueError: | |||
|
91 | pass | |||
104 | _runpager(p) |
|
92 | _runpager(p) | |
105 | if ui.configbool('pager', 'quiet'): |
|
|||
106 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
|
|||
107 | return orig(ui, options, cmd, cmdfunc) |
|
93 | return orig(ui, options, cmd, cmdfunc) | |
108 |
|
94 | |||
109 | extensions.wrapfunction(dispatch, '_runcommand', pagecmd) |
|
95 | extensions.wrapfunction(dispatch, '_runcommand', pagecmd) |
@@ -1311,6 +1311,12 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1311 | # | |
|
1311 | # | | |
1312 | # base o - parent of amending changeset |
|
1312 | # base o - parent of amending changeset | |
1313 |
|
1313 | |||
|
1314 | # Update extra dict from amended commit (e.g. to preserve graft source) | |||
|
1315 | extra.update(old.extra()) | |||
|
1316 | ||||
|
1317 | # Also update it from the intermediate commit or from the wctx | |||
|
1318 | extra.update(ctx.extra()) | |||
|
1319 | ||||
1314 | files = set(old.files()) |
|
1320 | files = set(old.files()) | |
1315 |
|
1321 | |||
1316 | # Second, we use either the commit we just did, or if there were no |
|
1322 | # Second, we use either the commit we just did, or if there were no | |
@@ -1322,7 +1328,6 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1322 | user = ctx.user() |
|
1328 | user = ctx.user() | |
1323 | date = ctx.date() |
|
1329 | date = ctx.date() | |
1324 | message = ctx.description() |
|
1330 | message = ctx.description() | |
1325 | extra = ctx.extra() |
|
|||
1326 | # Recompute copies (avoid recording a -> b -> a) |
|
1331 | # Recompute copies (avoid recording a -> b -> a) | |
1327 | copied = copies.pathcopies(base, ctx) |
|
1332 | copied = copies.pathcopies(base, ctx) | |
1328 |
|
1333 |
@@ -196,6 +196,8 b' def addremove(ui, repo, *pats, **opts):' | |||||
196 | be identical) as its parameter. Detecting renamed files this way |
|
196 | be identical) as its parameter. Detecting renamed files this way | |
197 | can be expensive. After using this option, :hg:`status -C` can be |
|
197 | can be expensive. After using this option, :hg:`status -C` can be | |
198 | used to check which files were identified as moved or renamed. |
|
198 | used to check which files were identified as moved or renamed. | |
|
199 | If this option is not specified, only renames of identical files | |||
|
200 | are detected. | |||
199 |
|
201 | |||
200 | Returns 0 if all files are successfully added. |
|
202 | Returns 0 if all files are successfully added. | |
201 | """ |
|
203 | """ |
@@ -555,7 +555,7 b' static inline int nt_level(const char *n' | |||||
555 | */ |
|
555 | */ | |
556 | static int nt_find(indexObject *self, const char *node, Py_ssize_t nodelen) |
|
556 | static int nt_find(indexObject *self, const char *node, Py_ssize_t nodelen) | |
557 | { |
|
557 | { | |
558 | int level, off; |
|
558 | int level, maxlevel, off; | |
559 |
|
559 | |||
560 | if (nodelen == 20 && node[0] == '\0' && memcmp(node, nullid, 20) == 0) |
|
560 | if (nodelen == 20 && node[0] == '\0' && memcmp(node, nullid, 20) == 0) | |
561 | return -1; |
|
561 | return -1; | |
@@ -563,7 +563,9 b' static int nt_find(indexObject *self, co' | |||||
563 | if (self->nt == NULL) |
|
563 | if (self->nt == NULL) | |
564 | return -2; |
|
564 | return -2; | |
565 |
|
565 | |||
566 | for (level = off = 0; level < nodelen; level++) { |
|
566 | maxlevel = nodelen > 20 ? 40 : ((int)nodelen * 2); | |
|
567 | ||||
|
568 | for (level = off = 0; level < maxlevel; level++) { | |||
567 | int k = nt_level(node, level); |
|
569 | int k = nt_level(node, level); | |
568 | nodetree *n = &self->nt[off]; |
|
570 | nodetree *n = &self->nt[off]; | |
569 | int v = n->children[k]; |
|
571 | int v = n->children[k]; | |
@@ -606,7 +608,7 b' static int nt_insert(indexObject *self, ' | |||||
606 | int level = 0; |
|
608 | int level = 0; | |
607 | int off = 0; |
|
609 | int off = 0; | |
608 |
|
610 | |||
609 |
while (level < |
|
611 | while (level < 40) { | |
610 | int k = nt_level(node, level); |
|
612 | int k = nt_level(node, level); | |
611 | nodetree *n; |
|
613 | nodetree *n; | |
612 | int v; |
|
614 | int v; |
@@ -926,7 +926,7 b' def matching(repo, subset, x):' | |||||
926 |
|
926 | |||
927 | Special fields are ``summary`` and ``metadata``: |
|
927 | Special fields are ``summary`` and ``metadata``: | |
928 | ``summary`` matches the first line of the description. |
|
928 | ``summary`` matches the first line of the description. | |
929 |
``meta |
|
929 | ``metadata`` is equivalent to matching ``description user date`` | |
930 | (i.e. it matches the main metadata fields). |
|
930 | (i.e. it matches the main metadata fields). | |
931 |
|
931 | |||
932 | ``metadata`` is the default field which is used when no fields are |
|
932 | ``metadata`` is the default field which is used when no fields are | |
@@ -996,7 +996,7 b' def matching(repo, subset, x):' | |||||
996 | # is only one field to match) |
|
996 | # is only one field to match) | |
997 | getinfo = lambda r: [f(r) for f in getfieldfuncs] |
|
997 | getinfo = lambda r: [f(r) for f in getfieldfuncs] | |
998 |
|
998 | |||
999 |
matches = |
|
999 | matches = set() | |
1000 | for rev in revs: |
|
1000 | for rev in revs: | |
1001 | target = getinfo(rev) |
|
1001 | target = getinfo(rev) | |
1002 | for r in subset: |
|
1002 | for r in subset: | |
@@ -1006,10 +1006,8 b' def matching(repo, subset, x):' | |||||
1006 | match = False |
|
1006 | match = False | |
1007 | break |
|
1007 | break | |
1008 | if match: |
|
1008 | if match: | |
1009 |
matches.a |
|
1009 | matches.add(r) | |
1010 | if len(revs) > 1: |
|
1010 | return [r for r in subset if r in matches] | |
1011 | matches = sorted(set(matches)) |
|
|||
1012 | return matches |
|
|||
1013 |
|
1011 | |||
1014 | def reverse(repo, subset, x): |
|
1012 | def reverse(repo, subset, x): | |
1015 | """``reverse(set)`` |
|
1013 | """``reverse(set)`` |
@@ -220,9 +220,6 b'' | |||||
220 | > raise util.Abort(_('qfold cannot fold already applied patch %s') % p) |
|
220 | > raise util.Abort(_('qfold cannot fold already applied patch %s') % p) | |
221 | warning: line over 80 characters |
|
221 | warning: line over 80 characters | |
222 | hgext/mq.py:0: |
|
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 | > ('U', 'noupdate', None, _('do not update the new working directories')), |
|
223 | > ('U', 'noupdate', None, _('do not update the new working directories')), | |
227 | warning: line over 80 characters |
|
224 | warning: line over 80 characters | |
228 | hgext/mq.py:0: |
|
225 | hgext/mq.py:0: |
@@ -316,3 +316,37 b" Can't rollback an amend:" | |||||
316 | $ hg rollback |
|
316 | $ hg rollback | |
317 | no rollback information available |
|
317 | no rollback information available | |
318 | [1] |
|
318 | [1] | |
|
319 | ||||
|
320 | Preserve extra dict (issue3430): | |||
|
321 | ||||
|
322 | $ hg branch a | |||
|
323 | marked working directory as branch a | |||
|
324 | (branches are permanent and global, did you want a bookmark?) | |||
|
325 | $ echo a >> a | |||
|
326 | $ hg ci -ma | |||
|
327 | $ hg ci --amend -m "a'" | |||
|
328 | saved backup bundle to $TESTTMP/.hg/strip-backup/167f8e3031df-amend-backup.hg | |||
|
329 | $ hg log -r . --template "{branch}\n" | |||
|
330 | a | |||
|
331 | $ hg ci --amend -m "a''" | |||
|
332 | saved backup bundle to $TESTTMP/.hg/strip-backup/ceac1a44c806-amend-backup.hg | |||
|
333 | $ hg log -r . --template "{branch}\n" | |||
|
334 | a | |||
|
335 | ||||
|
336 | Also preserve other entries in the dict that are in the old commit, | |||
|
337 | first graft something so there's an additional entry: | |||
|
338 | ||||
|
339 | $ hg up 0 -q | |||
|
340 | $ echo z > z | |||
|
341 | $ hg ci -Am 'fork' | |||
|
342 | adding z | |||
|
343 | created new head | |||
|
344 | $ hg up 11 | |||
|
345 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
346 | $ hg graft 12 | |||
|
347 | grafting revision 12 | |||
|
348 | $ hg ci --amend -m 'graft amend' | |||
|
349 | saved backup bundle to $TESTTMP/.hg/strip-backup/18a5124daf7a-amend-backup.hg | |||
|
350 | $ hg log -r . --debug | grep extra | |||
|
351 | extra: branch=a | |||
|
352 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
@@ -150,3 +150,134 b' and now we try it one more time with a u' | |||||
150 | abort: cannot push to a previous patch: a |
|
150 | abort: cannot push to a previous patch: a | |
151 | [255] |
|
151 | [255] | |
152 |
|
152 | |||
|
153 | test qpop --force and backup files | |||
|
154 | ||||
|
155 | $ hg qpop -a | |||
|
156 | popping b | |||
|
157 | patch queue now empty | |||
|
158 | $ hg qq --create force | |||
|
159 | $ echo a > a | |||
|
160 | $ echo b > b | |||
|
161 | $ echo c > c | |||
|
162 | $ hg ci -Am add a b c | |||
|
163 | $ echo a >> a | |||
|
164 | $ hg rm b | |||
|
165 | $ hg rm c | |||
|
166 | $ hg qnew p1 | |||
|
167 | $ echo a >> a | |||
|
168 | $ echo bb > b | |||
|
169 | $ hg add b | |||
|
170 | $ echo cc > c | |||
|
171 | $ hg add c | |||
|
172 | $ hg qpop --force --verbose | |||
|
173 | saving current version of a as a.orig | |||
|
174 | saving current version of b as b.orig | |||
|
175 | saving current version of c as c.orig | |||
|
176 | popping p1 | |||
|
177 | patch queue now empty | |||
|
178 | $ hg st | |||
|
179 | ? a.orig | |||
|
180 | ? b.orig | |||
|
181 | ? c.orig | |||
|
182 | ? untracked-file | |||
|
183 | $ cat a.orig | |||
|
184 | a | |||
|
185 | a | |||
|
186 | a | |||
|
187 | $ cat b.orig | |||
|
188 | bb | |||
|
189 | $ cat c.orig | |||
|
190 | cc | |||
|
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 | ||||
|
205 | test qpush --force and backup files | |||
|
206 | ||||
|
207 | $ echo a >> a | |||
|
208 | $ hg qnew p2 | |||
|
209 | $ echo b >> b | |||
|
210 | $ echo d > d | |||
|
211 | $ echo e > e | |||
|
212 | $ hg add d e | |||
|
213 | $ hg rm c | |||
|
214 | $ hg qnew p3 | |||
|
215 | $ hg qpop -a | |||
|
216 | popping p3 | |||
|
217 | popping p2 | |||
|
218 | patch queue now empty | |||
|
219 | $ echo a >> a | |||
|
220 | $ echo b1 >> b | |||
|
221 | $ echo d1 > d | |||
|
222 | $ hg add d | |||
|
223 | $ echo e1 > e | |||
|
224 | $ hg qpush -a --force --verbose | |||
|
225 | applying p2 | |||
|
226 | saving current version of a as a.orig | |||
|
227 | patching file a | |||
|
228 | a | |||
|
229 | applying p3 | |||
|
230 | saving current version of b as b.orig | |||
|
231 | saving current version of d as d.orig | |||
|
232 | patching file b | |||
|
233 | patching file c | |||
|
234 | patching file d | |||
|
235 | file d already exists | |||
|
236 | 1 out of 1 hunks FAILED -- saving rejects to file d.rej | |||
|
237 | patching file e | |||
|
238 | file e already exists | |||
|
239 | 1 out of 1 hunks FAILED -- saving rejects to file e.rej | |||
|
240 | patch failed to apply | |||
|
241 | b | |||
|
242 | patch failed, rejects left in working dir | |||
|
243 | errors during apply, please fix and refresh p3 | |||
|
244 | [2] | |||
|
245 | $ cat a.orig | |||
|
246 | a | |||
|
247 | a | |||
|
248 | $ cat b.orig | |||
|
249 | b | |||
|
250 | b1 | |||
|
251 | $ cat d.orig | |||
|
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] |
@@ -1356,11 +1356,15 b' qpush should fail, local changes' | |||||
1356 |
|
1356 | |||
1357 | apply force, should discard changes in hello, but not bye |
|
1357 | apply force, should discard changes in hello, but not bye | |
1358 |
|
1358 | |||
1359 | $ hg qpush -f |
|
1359 | $ hg qpush -f --verbose | |
1360 | applying empty |
|
1360 | applying empty | |
|
1361 | saving current version of hello.txt as hello.txt.orig | |||
|
1362 | patching file hello.txt | |||
|
1363 | hello.txt | |||
1361 | now at: empty |
|
1364 | now at: empty | |
1362 | $ hg st |
|
1365 | $ hg st | |
1363 | M bye.txt |
|
1366 | M bye.txt | |
|
1367 | ? hello.txt.orig | |||
1364 | $ hg diff --config diff.nodates=True |
|
1368 | $ hg diff --config diff.nodates=True | |
1365 | diff -r ba252371dbc1 bye.txt |
|
1369 | diff -r ba252371dbc1 bye.txt | |
1366 | --- a/bye.txt |
|
1370 | --- a/bye.txt |
General Comments 0
You need to be logged in to leave comments.
Login now