mercurial/merge.py
changeset 18640 a8648f32b8ed
parent 18639 5774732bb5e5
child 18650 de0bd4bfc6d7
equal deleted inserted replaced
18639:5774732bb5e5 18640:a8648f32b8ed
   347 
   347 
   348     mctx is the context to be merged into the working copy
   348     mctx is the context to be merged into the working copy
   349 
   349 
   350     yields tuples for progress updates
   350     yields tuples for progress updates
   351     """
   351     """
       
   352     verbose = repo.ui.verbose
       
   353     unlink = util.unlinkpath
       
   354     wjoin = repo.wjoin
       
   355     fctx = mctx.filectx
       
   356     wwrite = repo.wwrite
   352     audit = repo.wopener.audit
   357     audit = repo.wopener.audit
   353     i = 0
   358     i = 0
   354     for arg in args:
   359     for arg in args:
   355         f = arg[0]
   360         f = arg[0]
   356         if arg[1] == 'r':
   361         if arg[1] == 'r':
   357             repo.ui.note(_("removing %s\n") % f)
   362             if verbose:
       
   363                 repo.ui.note(_("removing %s\n") % f)
   358             audit(f)
   364             audit(f)
   359             try:
   365             try:
   360                 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
   366                 unlink(wjoin(f), ignoremissing=True)
   361             except OSError, inst:
   367             except OSError, inst:
   362                 repo.ui.warn(_("update failed to remove %s: %s!\n") %
   368                 repo.ui.warn(_("update failed to remove %s: %s!\n") %
   363                              (f, inst.strerror))
   369                              (f, inst.strerror))
   364         else:
   370         else:
   365             repo.ui.note(_("getting %s\n") % f)
   371             if verbose:
   366             repo.wwrite(f, mctx.filectx(f).data(), arg[2][0])
   372                 repo.ui.note(_("getting %s\n") % f)
       
   373             wwrite(f, fctx(f).data(), arg[2][0])
   367         if i == 100:
   374         if i == 100:
   368             yield i, f
   375             yield i, f
   369             i = 0
   376             i = 0
   370         i += 1
   377         i += 1
   371     if i > 0:
   378     if i > 0:
   440                          unit=_('files'))
   447                          unit=_('files'))
   441 
   448 
   442     if hgsub and hgsub[0] == 'g':
   449     if hgsub and hgsub[0] == 'g':
   443         subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
   450         subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
   444 
   451 
       
   452     _updating = _('updating')
       
   453     _files = _('files')
       
   454     progress = repo.ui.progress
       
   455 
   445     for i, a in enumerate(actions):
   456     for i, a in enumerate(actions):
   446         f, m, args, msg = a
   457         f, m, args, msg = a
   447         repo.ui.progress(_('updating'), z + i + 1, item=f, total=numupdates,
   458         progress(_updating, z + i + 1, item=f, total=numupdates, unit=_files)
   448                          unit=_('files'))
       
   449         if m == "m": # merge
   459         if m == "m": # merge
   450             if fd == '.hgsubstate': # subrepo states need updating
   460             if fd == '.hgsubstate': # subrepo states need updating
   451                 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
   461                 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
   452                                  overwrite)
   462                                  overwrite)
   453                 continue
   463                 continue
   488             flags, = args
   498             flags, = args
   489             audit(f)
   499             audit(f)
   490             util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
   500             util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
   491             updated += 1
   501             updated += 1
   492     ms.commit()
   502     ms.commit()
   493     repo.ui.progress(_('updating'), None, total=numupdates, unit=_('files'))
   503     progress(_updating, None, total=numupdates, unit=_files)
   494 
   504 
   495     return updated, merged, removed, unresolved
   505     return updated, merged, removed, unresolved
   496 
   506 
   497 def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial):
   507 def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial):
   498     "Calculate the actions needed to merge mctx into tctx"
   508     "Calculate the actions needed to merge mctx into tctx"