Show More
@@ -1356,8 +1356,6 b' def revert(ui, repo, ctx, parents, *pats' | |||
|
1356 | 1356 | if path in names: |
|
1357 | 1357 | return |
|
1358 | 1358 | if path in repo[node].substate: |
|
1359 | ui.warn("%s: %s\n" % (m.rel(path), | |
|
1360 | 'reverting subrepos is unsupported')) | |
|
1361 | 1359 | return |
|
1362 | 1360 | path_ = path + '/' |
|
1363 | 1361 | for f in names: |
@@ -1371,6 +1369,11 b' def revert(ui, repo, ctx, parents, *pats' | |||
|
1371 | 1369 | if abs not in names: |
|
1372 | 1370 | names[abs] = m.rel(abs), m.exact(abs) |
|
1373 | 1371 | |
|
1372 | 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 | ||
|
1374 | 1377 | m = scmutil.matchfiles(repo, names) |
|
1375 | 1378 | changes = repo.status(match=m)[:4] |
|
1376 | 1379 | modified, added, removed, deleted = map(set, changes) |
@@ -1499,6 +1502,10 b' def revert(ui, repo, ctx, parents, *pats' | |||
|
1499 | 1502 | checkout(f) |
|
1500 | 1503 | normal(f) |
|
1501 | 1504 | |
|
1505 | if targetsubs: | |
|
1506 | # Revert the subrepos on the revert list | |
|
1507 | for sub in targetsubs: | |
|
1508 | ctx.sub(sub).revert(ui, ctx.substate[sub], *pats, **opts) | |
|
1502 | 1509 | finally: |
|
1503 | 1510 | wlock.release() |
|
1504 | 1511 |
@@ -368,6 +368,9 b' class abstractsubrepo(object):' | |||
|
368 | 368 | def forget(self, ui, match, prefix): |
|
369 | 369 | return [] |
|
370 | 370 | |
|
371 | def revert(self, ui, substate, *pats, **opts): | |
|
372 | return [] | |
|
373 | ||
|
371 | 374 | class hgsubrepo(abstractsubrepo): |
|
372 | 375 | def __init__(self, ctx, path, state): |
|
373 | 376 | self._path = path |
@@ -573,6 +576,14 b' class hgsubrepo(abstractsubrepo):' | |||
|
573 | 576 | return cmdutil.forget(ui, self._repo, match, |
|
574 | 577 | os.path.join(prefix, self._path), True) |
|
575 | 578 | |
|
579 | def revert(self, ui, substate, *pats, **opts): | |
|
580 | # reverting a subrepo is done by updating it to the revision | |
|
581 | # specified in the corresponding substate dictionary | |
|
582 | ui.status(_('reverting subrepo %s\n') % substate[0]) | |
|
583 | ||
|
584 | # Update the repo to the revision specified in the given substate | |
|
585 | self.get(substate, overwrite=True) | |
|
586 | ||
|
576 | 587 | class svnsubrepo(abstractsubrepo): |
|
577 | 588 | def __init__(self, ctx, path, state): |
|
578 | 589 | self._path = path |
@@ -42,11 +42,14 b" Revert can't (yet) revert subrepos:" | |||
|
42 | 42 | |
|
43 | 43 | $ echo b > s/a |
|
44 | 44 | $ hg revert s |
|
45 | s: reverting subrepos is unsupported | |
|
45 | abort: cannot revert subrepos without --no-backup | |
|
46 | [255] | |
|
46 | 47 | |
|
47 | 48 | Revert currently ignores subrepos by default |
|
48 | 49 | |
|
49 | 50 | $ hg revert -a |
|
51 | abort: cannot revert subrepos without --no-backup | |
|
52 | [255] | |
|
50 | 53 | $ hg revert -R s -a -C |
|
51 | 54 | reverting s/a (glob) |
|
52 | 55 |
General Comments 0
You need to be logged in to leave comments.
Login now