Show More
@@ -3445,6 +3445,7 b' def postcommitstatus(repo, pats, opts):' | |||||
3445 | return repo.status(match=scmutil.match(repo[None], pats, opts)) |
|
3445 | return repo.status(match=scmutil.match(repo[None], pats, opts)) | |
3446 |
|
3446 | |||
3447 | def revert(ui, repo, ctx, parents, *pats, **opts): |
|
3447 | def revert(ui, repo, ctx, parents, *pats, **opts): | |
|
3448 | opts = pycompat.byteskwargs(opts) | |||
3448 | parent, p2 = parents |
|
3449 | parent, p2 = parents | |
3449 | node = ctx.node() |
|
3450 | node = ctx.node() | |
3450 |
|
3451 | |||
@@ -3722,7 +3723,8 b' def revert(ui, repo, ctx, parents, *pats' | |||||
3722 | # Revert the subrepos on the revert list |
|
3723 | # Revert the subrepos on the revert list | |
3723 | for sub in targetsubs: |
|
3724 | for sub in targetsubs: | |
3724 | try: |
|
3725 | try: | |
3725 |
wctx.sub(sub).revert(ctx.substate[sub], *pats, |
|
3726 | wctx.sub(sub).revert(ctx.substate[sub], *pats, | |
|
3727 | **pycompat.strkwargs(opts)) | |||
3726 | except KeyError: |
|
3728 | except KeyError: | |
3727 | raise error.Abort("subrepository '%s' does not exist in %s!" |
|
3729 | raise error.Abort("subrepository '%s' does not exist in %s!" | |
3728 | % (sub, short(ctx.node()))) |
|
3730 | % (sub, short(ctx.node()))) |
@@ -4560,6 +4560,7 b' def revert(ui, repo, *pats, **opts):' | |||||
4560 | Returns 0 on success. |
|
4560 | Returns 0 on success. | |
4561 | """ |
|
4561 | """ | |
4562 |
|
4562 | |||
|
4563 | opts = pycompat.byteskwargs(opts) | |||
4563 | if opts.get("date"): |
|
4564 | if opts.get("date"): | |
4564 | if opts.get("rev"): |
|
4565 | if opts.get("rev"): | |
4565 | raise error.Abort(_("you can't specify a revision and a date")) |
|
4566 | raise error.Abort(_("you can't specify a revision and a date")) | |
@@ -4595,7 +4596,8 b' def revert(ui, repo, *pats, **opts):' | |||||
4595 | hint = _("use --all to revert all files") |
|
4596 | hint = _("use --all to revert all files") | |
4596 | raise error.Abort(msg, hint=hint) |
|
4597 | raise error.Abort(msg, hint=hint) | |
4597 |
|
4598 | |||
4598 |
return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, |
|
4599 | return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, | |
|
4600 | **pycompat.strkwargs(opts)) | |||
4599 |
|
4601 | |||
4600 | @command('rollback', dryrunopts + |
|
4602 | @command('rollback', dryrunopts + | |
4601 | [('f', 'force', False, _('ignore safety measures'))]) |
|
4603 | [('f', 'force', False, _('ignore safety measures'))]) |
@@ -1089,24 +1089,24 b' class hgsubrepo(abstractsubrepo):' | |||||
1089 | # 2. update the subrepo to the revision specified in |
|
1089 | # 2. update the subrepo to the revision specified in | |
1090 | # the corresponding substate dictionary |
|
1090 | # the corresponding substate dictionary | |
1091 | self.ui.status(_('reverting subrepo %s\n') % substate[0]) |
|
1091 | self.ui.status(_('reverting subrepo %s\n') % substate[0]) | |
1092 | if not opts.get('no_backup'): |
|
1092 | if not opts.get(r'no_backup'): | |
1093 | # Revert all files on the subrepo, creating backups |
|
1093 | # Revert all files on the subrepo, creating backups | |
1094 | # Note that this will not recursively revert subrepos |
|
1094 | # Note that this will not recursively revert subrepos | |
1095 | # We could do it if there was a set:subrepos() predicate |
|
1095 | # We could do it if there was a set:subrepos() predicate | |
1096 | opts = opts.copy() |
|
1096 | opts = opts.copy() | |
1097 | opts['date'] = None |
|
1097 | opts[r'date'] = None | |
1098 | opts['rev'] = substate[1] |
|
1098 | opts[r'rev'] = substate[1] | |
1099 |
|
1099 | |||
1100 | self.filerevert(*pats, **opts) |
|
1100 | self.filerevert(*pats, **opts) | |
1101 |
|
1101 | |||
1102 | # Update the repo to the revision specified in the given substate |
|
1102 | # Update the repo to the revision specified in the given substate | |
1103 | if not opts.get('dry_run'): |
|
1103 | if not opts.get(r'dry_run'): | |
1104 | self.get(substate, overwrite=True) |
|
1104 | self.get(substate, overwrite=True) | |
1105 |
|
1105 | |||
1106 | def filerevert(self, *pats, **opts): |
|
1106 | def filerevert(self, *pats, **opts): | |
1107 | ctx = self._repo[opts['rev']] |
|
1107 | ctx = self._repo[opts[r'rev']] | |
1108 | parents = self._repo.dirstate.parents() |
|
1108 | parents = self._repo.dirstate.parents() | |
1109 | if opts.get('all'): |
|
1109 | if opts.get(r'all'): | |
1110 | pats = ['set:modified()'] |
|
1110 | pats = ['set:modified()'] | |
1111 | else: |
|
1111 | else: | |
1112 | pats = [] |
|
1112 | pats = [] |
General Comments 0
You need to be logged in to leave comments.
Login now