Show More
@@ -1369,11 +1369,8 b' def revert(ui, repo, ctx, parents, *pats' | |||
|
1369 | 1369 | if abs not in names: |
|
1370 | 1370 | names[abs] = m.rel(abs), m.exact(abs) |
|
1371 | 1371 | |
|
1372 | # get the list of subrepos that must be reverted | |
|
1372 | 1373 | targetsubs = [s for s in repo[node].substate if m(s)] |
|
1373 | if targetsubs and not opts.get('no_backup'): | |
|
1374 | msg = _("cannot revert subrepos without --no-backup") | |
|
1375 | raise util.Abort(msg) | |
|
1376 | ||
|
1377 | 1374 | m = scmutil.matchfiles(repo, names) |
|
1378 | 1375 | changes = repo.status(match=m)[:4] |
|
1379 | 1376 | modified, added, removed, deleted = map(set, changes) |
@@ -577,13 +577,37 b' class hgsubrepo(abstractsubrepo):' | |||
|
577 | 577 | os.path.join(prefix, self._path), True) |
|
578 | 578 | |
|
579 | 579 | def revert(self, ui, substate, *pats, **opts): |
|
580 |
# reverting a subrepo is |
|
|
581 | # specified in the corresponding substate dictionary | |
|
580 | # reverting a subrepo is a 2 step process: | |
|
581 | # 1. if the no_backup is not set, revert all modified | |
|
582 | # files inside the subrepo | |
|
583 | # 2. update the subrepo to the revision specified in | |
|
584 | # the corresponding substate dictionary | |
|
582 | 585 | ui.status(_('reverting subrepo %s\n') % substate[0]) |
|
586 | if not opts.get('no_backup'): | |
|
587 | # Revert all files on the subrepo, creating backups | |
|
588 | # Note that this will not recursively revert subrepos | |
|
589 | # We could do it if there was a set:subrepos() predicate | |
|
590 | opts = opts.copy() | |
|
591 | opts['date'] = None | |
|
592 | opts['rev'] = substate[1] | |
|
593 | ||
|
594 | pats = [] | |
|
595 | if not opts['all']: | |
|
596 | pats = ['set:modified()'] | |
|
597 | self.filerevert(ui, *pats, **opts) | |
|
583 | 598 | |
|
584 | 599 | # Update the repo to the revision specified in the given substate |
|
585 | 600 | self.get(substate, overwrite=True) |
|
586 | 601 | |
|
602 | def filerevert(self, ui, *pats, **opts): | |
|
603 | ctx = self._repo[opts['rev']] | |
|
604 | parents = self._repo.dirstate.parents() | |
|
605 | if opts['all']: | |
|
606 | pats = ['set:modified()'] | |
|
607 | else: | |
|
608 | pats = [] | |
|
609 | cmdutil.revert(ui, self._repo, ctx, parents, *pats, **opts) | |
|
610 | ||
|
587 | 611 | class svnsubrepo(abstractsubrepo): |
|
588 | 612 | def __init__(self, ctx, path, state): |
|
589 | 613 | self._path = path |
@@ -38,20 +38,20 b' Issue2232: committing a subrepo without ' | |||
|
38 | 38 | update: (current) |
|
39 | 39 | $ hg ci -m1 |
|
40 | 40 | |
|
41 |
Revert |
|
|
41 | Revert subrepo: | |
|
42 | 42 | |
|
43 | 43 | $ echo b > s/a |
|
44 | 44 | $ hg revert s |
|
45 | abort: cannot revert subrepos without --no-backup | |
|
46 | [255] | |
|
47 | ||
|
48 | Revert currently ignores subrepos by default | |
|
45 | reverting subrepo s | |
|
46 | reverting s/a | |
|
47 | $ rm s/a.orig | |
|
49 | 48 | |
|
50 | $ hg revert -a | |
|
51 | abort: cannot revert subrepos without --no-backup | |
|
52 | [255] | |
|
53 | $ hg revert -R s -a -C | |
|
54 | reverting s/a (glob) | |
|
49 | Revert subrepo with no backup. The "reverting s/a" line is gone since | |
|
50 | we're really running 'hg update' in the subrepo: | |
|
51 | ||
|
52 | $ echo b > s/a | |
|
53 | $ hg revert --no-backup s | |
|
54 | reverting subrepo s | |
|
55 | 55 | |
|
56 | 56 | Issue2022: update -C |
|
57 | 57 |
General Comments 0
You need to be logged in to leave comments.
Login now