mercurial/merge.py
changeset 14398 ae1f7a5373e8
parent 14232 df2399663392
child 14405 f2295a829f47
equal deleted inserted replaced
14397:0368ad7963be 14398:ae1f7a5373e8
   294                 fca = repo.filectx(f, fileid=nullrev)
   294                 fca = repo.filectx(f, fileid=nullrev)
   295             ms.add(fcl, fco, fca, fd, flags)
   295             ms.add(fcl, fco, fca, fd, flags)
   296             if f != fd and move:
   296             if f != fd and move:
   297                 moves.append(f)
   297                 moves.append(f)
   298 
   298 
       
   299     audit = scmutil.pathauditor(repo.root)
       
   300 
   299     # remove renamed files after safely stored
   301     # remove renamed files after safely stored
   300     for f in moves:
   302     for f in moves:
   301         if os.path.lexists(repo.wjoin(f)):
   303         if os.path.lexists(repo.wjoin(f)):
   302             repo.ui.debug("removing %s\n" % f)
   304             repo.ui.debug("removing %s\n" % f)
       
   305             audit(f)
   303             os.unlink(repo.wjoin(f))
   306             os.unlink(repo.wjoin(f))
   304 
       
   305     audit_path = scmutil.pathauditor(repo.root)
       
   306 
   307 
   307     numupdates = len(action)
   308     numupdates = len(action)
   308     for i, a in enumerate(action):
   309     for i, a in enumerate(action):
   309         f, m = a[:2]
   310         f, m = a[:2]
   310         u.progress(_('updating'), i + 1, item=f, total=numupdates,
   311         u.progress(_('updating'), i + 1, item=f, total=numupdates,
   311                    unit=_('files'))
   312                    unit=_('files'))
   312         if f and f[0] == "/":
   313         if f and f[0] == "/":
   313             continue
   314             continue
   314         if m == "r": # remove
   315         if m == "r": # remove
   315             repo.ui.note(_("removing %s\n") % f)
   316             repo.ui.note(_("removing %s\n") % f)
   316             audit_path(f)
   317             audit(f)
   317             if f == '.hgsubstate': # subrepo states need updating
   318             if f == '.hgsubstate': # subrepo states need updating
   318                 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
   319                 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
   319             try:
   320             try:
   320                 util.unlinkpath(repo.wjoin(f))
   321                 util.unlinkpath(repo.wjoin(f))
   321             except OSError, inst:
   322             except OSError, inst:
   338                     merged += 1
   339                     merged += 1
   339             util.setflags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
   340             util.setflags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
   340             if (move and repo.dirstate.normalize(fd) != f
   341             if (move and repo.dirstate.normalize(fd) != f
   341                 and os.path.lexists(repo.wjoin(f))):
   342                 and os.path.lexists(repo.wjoin(f))):
   342                 repo.ui.debug("removing %s\n" % f)
   343                 repo.ui.debug("removing %s\n" % f)
       
   344                 audit(f)
   343                 os.unlink(repo.wjoin(f))
   345                 os.unlink(repo.wjoin(f))
   344         elif m == "g": # get
   346         elif m == "g": # get
   345             flags = a[2]
   347             flags = a[2]
   346             repo.ui.note(_("getting %s\n") % f)
   348             repo.ui.note(_("getting %s\n") % f)
   347             t = mctx.filectx(f).data()
   349             t = mctx.filectx(f).data()
   352                 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
   354                 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
   353         elif m == "d": # directory rename
   355         elif m == "d": # directory rename
   354             f2, fd, flags = a[2:]
   356             f2, fd, flags = a[2:]
   355             if f:
   357             if f:
   356                 repo.ui.note(_("moving %s to %s\n") % (f, fd))
   358                 repo.ui.note(_("moving %s to %s\n") % (f, fd))
       
   359                 audit(f)
   357                 t = wctx.filectx(f).data()
   360                 t = wctx.filectx(f).data()
   358                 repo.wwrite(fd, t, flags)
   361                 repo.wwrite(fd, t, flags)
   359                 util.unlinkpath(repo.wjoin(f))
   362                 util.unlinkpath(repo.wjoin(f))
   360             if f2:
   363             if f2:
   361                 repo.ui.note(_("getting %s to %s\n") % (f2, fd))
   364                 repo.ui.note(_("getting %s to %s\n") % (f2, fd))