mercurial/merge.py
changeset 26587 56b2bcea2529
parent 26570 c8b332b1eb1f
child 26606 2a405d307f8c
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
    20     nullrev,
    20     nullrev,
    21 )
    21 )
    22 from . import (
    22 from . import (
    23     copies,
    23     copies,
    24     destutil,
    24     destutil,
       
    25     error,
    25     filemerge,
    26     filemerge,
    26     obsolete,
    27     obsolete,
    27     subrepo,
    28     subrepo,
    28     util,
    29     util,
    29     worker,
    30     worker,
    96                 self._other = bin(record)
    97                 self._other = bin(record)
    97             elif rtype == 'F':
    98             elif rtype == 'F':
    98                 bits = record.split('\0')
    99                 bits = record.split('\0')
    99                 self._state[bits[0]] = bits[1:]
   100                 self._state[bits[0]] = bits[1:]
   100             elif not rtype.islower():
   101             elif not rtype.islower():
   101                 raise util.Abort(_('unsupported merge state record: %s')
   102                 raise error.Abort(_('unsupported merge state record: %s')
   102                                    % rtype)
   103                                    % rtype)
   103         self._dirty = False
   104         self._dirty = False
   104 
   105 
   105     def _readrecords(self):
   106     def _readrecords(self):
   106         """Read merge state from disk and return a list of record (TYPE, data)
   107         """Read merge state from disk and return a list of record (TYPE, data)
   344                     aborts.append(f)
   345                     aborts.append(f)
   345 
   346 
   346     for f in sorted(aborts):
   347     for f in sorted(aborts):
   347         repo.ui.warn(_("%s: untracked file differs\n") % f)
   348         repo.ui.warn(_("%s: untracked file differs\n") % f)
   348     if aborts:
   349     if aborts:
   349         raise util.Abort(_("untracked files in working directory differ "
   350         raise error.Abort(_("untracked files in working directory differ "
   350                            "from files in requested revision"))
   351                            "from files in requested revision"))
   351 
   352 
   352     for f, (m, args, msg) in actions.iteritems():
   353     for f, (m, args, msg) in actions.iteritems():
   353         if m == 'c':
   354         if m == 'c':
   354             actions[f] = ('g', args, msg)
   355             actions[f] = ('g', args, msg)
   417     # check case-folding collision in provisional merged manifest
   418     # check case-folding collision in provisional merged manifest
   418     foldmap = {}
   419     foldmap = {}
   419     for f in sorted(pmmf):
   420     for f in sorted(pmmf):
   420         fold = util.normcase(f)
   421         fold = util.normcase(f)
   421         if fold in foldmap:
   422         if fold in foldmap:
   422             raise util.Abort(_("case-folding collision between %s and %s")
   423             raise error.Abort(_("case-folding collision between %s and %s")
   423                              % (f, foldmap[fold]))
   424                              % (f, foldmap[fold]))
   424         foldmap[fold] = f
   425         foldmap[fold] = f
   425 
   426 
   426 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial,
   427 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial,
   427                   acceptremote, followcopies):
   428                   acceptremote, followcopies):
  1009 
  1010 
  1010         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
  1011         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
  1011 
  1012 
  1012         ### check phase
  1013         ### check phase
  1013         if not overwrite and len(pl) > 1:
  1014         if not overwrite and len(pl) > 1:
  1014             raise util.Abort(_("outstanding uncommitted merge"))
  1015             raise error.Abort(_("outstanding uncommitted merge"))
  1015         if branchmerge:
  1016         if branchmerge:
  1016             if pas == [p2]:
  1017             if pas == [p2]:
  1017                 raise util.Abort(_("merging with a working directory ancestor"
  1018                 raise error.Abort(_("merging with a working directory ancestor"
  1018                                    " has no effect"))
  1019                                    " has no effect"))
  1019             elif pas == [p1]:
  1020             elif pas == [p1]:
  1020                 if not mergeancestor and p1.branch() == p2.branch():
  1021                 if not mergeancestor and p1.branch() == p2.branch():
  1021                     raise util.Abort(_("nothing to merge"),
  1022                     raise error.Abort(_("nothing to merge"),
  1022                                      hint=_("use 'hg update' "
  1023                                      hint=_("use 'hg update' "
  1023                                             "or check 'hg heads'"))
  1024                                             "or check 'hg heads'"))
  1024             if not force and (wc.files() or wc.deleted()):
  1025             if not force and (wc.files() or wc.deleted()):
  1025                 raise util.Abort(_("uncommitted changes"),
  1026                 raise error.Abort(_("uncommitted changes"),
  1026                                  hint=_("use 'hg status' to list changes"))
  1027                                  hint=_("use 'hg status' to list changes"))
  1027             for s in sorted(wc.substate):
  1028             for s in sorted(wc.substate):
  1028                 wc.sub(s).bailifchanged()
  1029                 wc.sub(s).bailifchanged()
  1029 
  1030 
  1030         elif not overwrite:
  1031         elif not overwrite:
  1049                             hint = _("commit and merge, or update --clean to"
  1050                             hint = _("commit and merge, or update --clean to"
  1050                                      " discard changes")
  1051                                      " discard changes")
  1051                         else:
  1052                         else:
  1052                             hint = _("commit or update --clean to discard"
  1053                             hint = _("commit or update --clean to discard"
  1053                                      " changes")
  1054                                      " changes")
  1054                         raise util.Abort(msg, hint=hint)
  1055                         raise error.Abort(msg, hint=hint)
  1055                     else:  # node is none
  1056                     else:  # node is none
  1056                         msg = _("not a linear update")
  1057                         msg = _("not a linear update")
  1057                         hint = _("merge or update --check to force update")
  1058                         hint = _("merge or update --check to force update")
  1058                         raise util.Abort(msg, hint=hint)
  1059                         raise error.Abort(msg, hint=hint)
  1059                 else:
  1060                 else:
  1060                     # Allow jumping branches if clean and specific rev given
  1061                     # Allow jumping branches if clean and specific rev given
  1061                     pas = [p1]
  1062                     pas = [p1]
  1062 
  1063 
  1063         # deprecated config: merge.followcopies
  1064         # deprecated config: merge.followcopies