mercurial/commands.py
changeset 38146 009aa4af5093
parent 38131 46c2b19a1263
child 38147 58b08f4ce5f5
equal deleted inserted replaced
38145:6f67bfe4b82f 38146:009aa4af5093
  2220         cont = True
  2220         cont = True
  2221         if revs:
  2221         if revs:
  2222             raise error.Abort(_("can't specify --continue and revisions"))
  2222             raise error.Abort(_("can't specify --continue and revisions"))
  2223         # read in unfinished revisions
  2223         # read in unfinished revisions
  2224         try:
  2224         try:
  2225             nodes = repo.vfs.read('graftstate').splitlines()
  2225             nodes = _readgraftstate(repo)['nodes']
  2226             revs = [repo[node].rev() for node in nodes]
  2226             revs = [repo[node].rev() for node in nodes]
  2227         except IOError as inst:
  2227         except IOError as inst:
  2228             if inst.errno != errno.ENOENT:
  2228             if inst.errno != errno.ENOENT:
  2229                 raise
  2229                 raise
  2230             cmdutil.wrongtooltocontinue(repo, _('graft'))
  2230             cmdutil.wrongtooltocontinue(repo, _('graft'))
  2378     # remove state when we complete successfully
  2378     # remove state when we complete successfully
  2379     if not opts.get('dry_run'):
  2379     if not opts.get('dry_run'):
  2380         repo.vfs.unlinkpath('graftstate', ignoremissing=True)
  2380         repo.vfs.unlinkpath('graftstate', ignoremissing=True)
  2381 
  2381 
  2382     return 0
  2382     return 0
       
  2383 
       
  2384 def _readgraftstate(repo):
       
  2385     """read the graft state file and return a dict of the data stored in it"""
       
  2386     nodes = repo.vfs.read('graftstate').splitlines()
       
  2387     return {'nodes': nodes}
  2383 
  2388 
  2384 @command('grep',
  2389 @command('grep',
  2385     [('0', 'print0', None, _('end fields with NUL')),
  2390     [('0', 'print0', None, _('end fields with NUL')),
  2386     ('', 'all', None, _('print all revisions that match')),
  2391     ('', 'all', None, _('print all revisions that match')),
  2387     ('a', 'text', None, _('treat all files as text')),
  2392     ('a', 'text', None, _('treat all files as text')),