mercurial/subrepo.py
changeset 35168 3da4bd50103d
parent 34967 1a314176da9c
child 35184 ee64e677c3cf
equal deleted inserted replaced
35167:0b5716ec8500 35168:3da4bd50103d
  1087         # 1. if the no_backup is not set, revert all modified
  1087         # 1. if the no_backup is not set, revert all modified
  1088         #    files inside the subrepo
  1088         #    files inside the subrepo
  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 = []
  1113         cmdutil.revert(self.ui, self._repo, ctx, parents, *pats, **opts)
  1113         cmdutil.revert(self.ui, self._repo, ctx, parents, *pats, **opts)
  1114 
  1114