mercurial/merge.py
changeset 30581 43a9e02a7b7f
parent 30519 20a42325fdef
child 30856 41f6af50c0d8
equal deleted inserted replaced
30580:51e7c83e05ee 30581:43a9e02a7b7f
   792     acceptremote = accept the incoming changes without prompting
   792     acceptremote = accept the incoming changes without prompting
   793     """
   793     """
   794     if matcher is not None and matcher.always():
   794     if matcher is not None and matcher.always():
   795         matcher = None
   795         matcher = None
   796 
   796 
   797     copy, movewithdir, diverge, renamedelete = {}, {}, {}, {}
   797     copy, movewithdir, diverge, renamedelete, dirmove = {}, {}, {}, {}, {}
   798 
   798 
   799     # manifests fetched in order are going to be faster, so prime the caches
   799     # manifests fetched in order are going to be faster, so prime the caches
   800     [x.manifest() for x in
   800     [x.manifest() for x in
   801      sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())]
   801      sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())]
   802 
   802 
   803     if followcopies:
   803     if followcopies:
   804         ret = copies.mergecopies(repo, wctx, p2, pa)
   804         ret = copies.mergecopies(repo, wctx, p2, pa)
   805         copy, movewithdir, diverge, renamedelete = ret
   805         copy, movewithdir, diverge, renamedelete, dirmove = ret
   806 
   806 
   807     repo.ui.note(_("resolving manifests\n"))
   807     repo.ui.note(_("resolving manifests\n"))
   808     repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n"
   808     repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n"
   809                   % (bool(branchmerge), bool(force), bool(matcher)))
   809                   % (bool(branchmerge), bool(force), bool(matcher)))
   810     repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2))
   810     repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2))
   919                     actions[f] = ('c', (fl2,), "remote created")
   919                     actions[f] = ('c', (fl2,), "remote created")
   920                 else:
   920                 else:
   921                     actions[f] = ('cm', (fl2, pa.node()),
   921                     actions[f] = ('cm', (fl2, pa.node()),
   922                                   "remote created, get or merge")
   922                                   "remote created, get or merge")
   923             elif n2 != ma[f]:
   923             elif n2 != ma[f]:
   924                 if acceptremote:
   924                 df = None
       
   925                 for d in dirmove:
       
   926                     if f.startswith(d):
       
   927                         # new file added in a directory that was moved
       
   928                         df = dirmove[d] + f[len(d):]
       
   929                         break
       
   930                 if df in m1:
       
   931                     actions[df] = ('m', (df, f, f, False, pa.node()),
       
   932                             "local directory rename - respect move from " + f)
       
   933                 elif acceptremote:
   925                     actions[f] = ('c', (fl2,), "remote recreating")
   934                     actions[f] = ('c', (fl2,), "remote recreating")
   926                 else:
   935                 else:
   927                     actions[f] = ('dc', (None, f, f, False, pa.node()),
   936                     actions[f] = ('dc', (None, f, f, False, pa.node()),
   928                                   "prompt deleted/changed")
   937                                   "prompt deleted/changed")
   929 
   938