Show More
@@ -2700,9 +2700,12 b' def debugpvec(ui, repo, a, b=None):' | |||||
2700 | pa.distance(pb), rel)) |
|
2700 | pa.distance(pb), rel)) | |
2701 |
|
2701 | |||
2702 | @command('debugrebuilddirstate|debugrebuildstate', |
|
2702 | @command('debugrebuilddirstate|debugrebuildstate', | |
2703 |
[('r', 'rev', '', _('revision to rebuild to'), _('REV')) |
|
2703 | [('r', 'rev', '', _('revision to rebuild to'), _('REV')), | |
|
2704 | ('', 'minimal', None, _('only rebuild files that are inconsistent with ' | |||
|
2705 | 'the working copy parent')), | |||
|
2706 | ], | |||
2704 | _('[-r REV]')) |
|
2707 | _('[-r REV]')) | |
2705 | def debugrebuilddirstate(ui, repo, rev): |
|
2708 | def debugrebuilddirstate(ui, repo, rev, **opts): | |
2706 | """rebuild the dirstate as it would look like for the given revision |
|
2709 | """rebuild the dirstate as it would look like for the given revision | |
2707 |
|
2710 | |||
2708 | If no revision is specified the first current parent will be used. |
|
2711 | If no revision is specified the first current parent will be used. | |
@@ -2711,13 +2714,33 b' def debugrebuilddirstate(ui, repo, rev):' | |||||
2711 | The actual working directory content or existing dirstate |
|
2714 | The actual working directory content or existing dirstate | |
2712 | information such as adds or removes is not considered. |
|
2715 | information such as adds or removes is not considered. | |
2713 |
|
2716 | |||
|
2717 | ``minimal`` will only rebuild the dirstate status for files that claim to be | |||
|
2718 | tracked but are not in the parent manifest, or that exist in the parent | |||
|
2719 | manifest but are not in the dirstate. It will not change adds, removes, or | |||
|
2720 | modified files that are in the working copy parent. | |||
|
2721 | ||||
2714 | One use of this command is to make the next :hg:`status` invocation |
|
2722 | One use of this command is to make the next :hg:`status` invocation | |
2715 | check the actual file content. |
|
2723 | check the actual file content. | |
2716 | """ |
|
2724 | """ | |
2717 | ctx = scmutil.revsingle(repo, rev) |
|
2725 | ctx = scmutil.revsingle(repo, rev) | |
2718 | wlock = repo.wlock() |
|
2726 | wlock = repo.wlock() | |
2719 | try: |
|
2727 | try: | |
2720 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) |
|
2728 | dirstate = repo.dirstate | |
|
2729 | ||||
|
2730 | # See command doc for what minimal does. | |||
|
2731 | if opts.get('minimal'): | |||
|
2732 | dirstatefiles = set(dirstate) | |||
|
2733 | ctxfiles = set(ctx.manifest().keys()) | |||
|
2734 | for file in (dirstatefiles | ctxfiles): | |||
|
2735 | indirstate = file in dirstatefiles | |||
|
2736 | inctx = file in ctxfiles | |||
|
2737 | ||||
|
2738 | if indirstate and not inctx and dirstate[file] != 'a': | |||
|
2739 | dirstate.drop(file) | |||
|
2740 | elif inctx and not indirstate: | |||
|
2741 | dirstate.normallookup(file) | |||
|
2742 | else: | |||
|
2743 | dirstate.rebuild(ctx.node(), ctx.manifest()) | |||
2721 | finally: |
|
2744 | finally: | |
2722 | wlock.release() |
|
2745 | wlock.release() | |
2723 |
|
2746 |
@@ -254,7 +254,7 b' Show all commands + options' | |||||
254 | debugpathcomplete: full, normal, added, removed |
|
254 | debugpathcomplete: full, normal, added, removed | |
255 | debugpushkey: |
|
255 | debugpushkey: | |
256 | debugpvec: |
|
256 | debugpvec: | |
257 | debugrebuilddirstate: rev |
|
257 | debugrebuilddirstate: rev, minimal | |
258 | debugrebuildfncache: |
|
258 | debugrebuildfncache: | |
259 | debugrename: rev |
|
259 | debugrename: rev | |
260 | debugrevlog: changelog, manifest, dir, dump |
|
260 | debugrevlog: changelog, manifest, dir, dump |
General Comments 0
You need to be logged in to leave comments.
Login now