mercurial/merge.py
changeset 27740 da5634e1b8a3
parent 27657 7b5c8c8a2f8c
child 27741 3951f132958f
equal deleted inserted replaced
27739:d6d3cf5fda6f 27740:da5634e1b8a3
   555         """queues a file to be marked modified in the dirstate
   555         """queues a file to be marked modified in the dirstate
   556 
   556 
   557         Meant for use by custom merge drivers."""
   557         Meant for use by custom merge drivers."""
   558         self._results[f] = 0, 'g'
   558         self._results[f] = 0, 'g'
   559 
   559 
       
   560 def _getcheckunknownconfig(repo, section, name):
       
   561     config = repo.ui.config(section, name, default='abort')
       
   562     valid = ['abort', 'ignore', 'warn']
       
   563     if config not in valid:
       
   564         validstr = ', '.join(["'" + v + "'" for v in valid])
       
   565         raise error.ConfigError(_("%s.%s not valid "
       
   566                                   "('%s' is none of %s)")
       
   567                                 % (section, name, config, validstr))
       
   568     return config
       
   569 
   560 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
   570 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
   561     if f2 is None:
   571     if f2 is None:
   562         f2 = f
   572         f2 = f
   563     return (repo.wvfs.isfileorlink(f)
   573     return (repo.wvfs.isfileorlink(f)
   564         and repo.wvfs.audit.check(f)
   574         and repo.wvfs.audit.check(f)
   571     files. For some actions, the result is to abort; for others, it is to
   581     files. For some actions, the result is to abort; for others, it is to
   572     choose a different action.
   582     choose a different action.
   573     """
   583     """
   574     conflicts = set()
   584     conflicts = set()
   575     if not force:
   585     if not force:
   576         config = repo.ui.config('merge', 'checkunknown', default='abort')
   586         config = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
   577         valid = ['abort', 'ignore', 'warn']
       
   578         if config not in valid:
       
   579             validstr = ', '.join(["'" + v + "'" for v in valid])
       
   580             raise error.ConfigError(_("merge.checkunknown not valid "
       
   581                                       "('%s' is none of %s)")
       
   582                                     % (config, validstr))
       
   583 
       
   584         for f, (m, args, msg) in actions.iteritems():
   587         for f, (m, args, msg) in actions.iteritems():
   585             if m in ('c', 'dc'):
   588             if m in ('c', 'dc'):
   586                 if _checkunknownfile(repo, wctx, mctx, f):
   589                 if _checkunknownfile(repo, wctx, mctx, f):
   587                     conflicts.add(f)
   590                     conflicts.add(f)
   588             elif m == 'dg':
   591             elif m == 'dg':