comparison mercurial/cmdutil.py @ 16430:6883c2363f44

revert: add support for reverting subrepos without --no-backup and/or --all When a subrepo is reverted but --no-backup is not set, call revert on the subrepo that is being reverted prior to updating it to the revision specified in the parent repo's .hgsubstate file. The --all flag is passed down to the subrepo when it is being reverted. If the --all flag is not set, all files that are modified on the subrepo will be reverted.
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Wed, 28 Mar 2012 11:42:17 +0200
parents 71dcce391a44
children 55982f62651f
comparison
equal deleted inserted replaced
16429:71dcce391a44 16430:6883c2363f44
1367 m.bad = badfn 1367 m.bad = badfn
1368 for abs in repo[node].walk(m): 1368 for abs in repo[node].walk(m):
1369 if abs not in names: 1369 if abs not in names:
1370 names[abs] = m.rel(abs), m.exact(abs) 1370 names[abs] = m.rel(abs), m.exact(abs)
1371 1371
1372 # get the list of subrepos that must be reverted
1372 targetsubs = [s for s in repo[node].substate if m(s)] 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 m = scmutil.matchfiles(repo, names) 1374 m = scmutil.matchfiles(repo, names)
1378 changes = repo.status(match=m)[:4] 1375 changes = repo.status(match=m)[:4]
1379 modified, added, removed, deleted = map(set, changes) 1376 modified, added, removed, deleted = map(set, changes)
1380 1377
1381 # if f is a rename, also revert the source 1378 # if f is a rename, also revert the source