Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 24463:06d199e66bbc
revert: handle subrepos missing in the given --rev
The list of subrepos to revert is currently based on the given --rev, so there
is currently no way for this to fail. Using the --rev context is wrong though,
because if the subrepo doesn't exist in --rev, it is skipped, so it won't be
changed. This change makes it so that the revert aborts, which is what happens
if a plain file is reverted to -1. Finding matches based on --rev is also
inconsistent with evaluating files against the working directory (5b85a5bc5bbb).
This change is made now, so as to not cause breakage when the context is
switched in an upcoming patch.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 25 Mar 2015 21:54:47 -0400 |
parents | 16961d43dc89 |
children | 30ddc3cf76df |
comparison
equal
deleted
inserted
replaced
24462:40b05303ac32 | 24463:06d199e66bbc |
---|---|
3053 targetsubs = sorted(s for s in ctx.substate if subrepomatch(s)) | 3053 targetsubs = sorted(s for s in ctx.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 ctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) | 3058 try: |
3059 ctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) | |
3060 except KeyError: | |
3061 raise util.Abort("subrepository '%s' does not exist in %s!" | |
3062 % (sub, short(ctx.node()))) | |
3059 finally: | 3063 finally: |
3060 wlock.release() | 3064 wlock.release() |
3061 | 3065 |
3062 def _revertprefetch(repo, ctx, *files): | 3066 def _revertprefetch(repo, ctx, *files): |
3063 """Let extension changing the storage layer prefetch content""" | 3067 """Let extension changing the storage layer prefetch content""" |