Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 24464:30ddc3cf76df
revert: evaluate subrepos to revert against the working directory
Reverting to a revision where the subrepo didn't exist will now abort, and
matching subrepos against the working directory is consistent with how filesets
are evaluated since 5b85a5bc5bbb.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 25 Mar 2015 22:20:44 -0400 |
parents | 06d199e66bbc |
children | 1ff35d76421c |
comparison
equal
deleted
inserted
replaced
24463:06d199e66bbc | 24464:30ddc3cf76df |
---|---|
3047 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) | 3047 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) |
3048 interactive = opts.get('interactive', False) | 3048 interactive = opts.get('interactive', False) |
3049 _performrevert(repo, parents, ctx, actions, interactive) | 3049 _performrevert(repo, parents, ctx, actions, interactive) |
3050 | 3050 |
3051 # get the list of subrepos that must be reverted | 3051 # get the list of subrepos that must be reverted |
3052 subrepomatch = scmutil.match(ctx, pats, opts) | 3052 subrepomatch = scmutil.match(wctx, pats, opts) |
3053 targetsubs = sorted(s for s in ctx.substate if subrepomatch(s)) | 3053 targetsubs = sorted(s for s in wctx.substate if subrepomatch(s)) |
3054 | 3054 |
3055 if targetsubs: | 3055 if targetsubs: |
3056 # Revert the subrepos on the revert list | 3056 # Revert the subrepos on the revert list |
3057 for sub in targetsubs: | 3057 for sub in targetsubs: |
3058 try: | 3058 try: |
3059 ctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) | 3059 wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) |
3060 except KeyError: | 3060 except KeyError: |
3061 raise util.Abort("subrepository '%s' does not exist in %s!" | 3061 raise util.Abort("subrepository '%s' does not exist in %s!" |
3062 % (sub, short(ctx.node()))) | 3062 % (sub, short(ctx.node()))) |
3063 finally: | 3063 finally: |
3064 wlock.release() | 3064 wlock.release() |