D776: merge: add merge action 'p' to record path conflicts during update

ryanmce (Ryan McElroy) phabricator at mercurial-scm.org
Mon Sep 25 15:35:35 EDT 2017


ryanmce accepted this revision.
ryanmce added a comment.


  There's some opportunities here but most are definitely outside the scope of this patch. One inline to consider but do what makes sense to you.

INLINE COMMENTS

> merge.py:1250-1259
> +        repo.ui.status(
> +            _("%s: path conflict - a file or link has the same name as a "
> +              "directory\n")
> +            % f)
> +        if fo == 'l':
> +            repo.ui.status(_("the local file has been renamed to %s\n") % f1)
> +        else:

I've seen this trick used in the mercurial codebase to fit more on a single line:

  s = repo.ui.status
  ...
  s(_("%s: path conflict - a file or link has the same name as a directory\n") % f)
  ...
  s(_("resolve manually then use 'hg resolve --mark %s'\n") % f)
  ...

It may help to tighten up the code a bit here.

> merge.py:1711
> +        actions = dict((m, [])
> +                       for m in 'a am f g cd dc r dm dg m e k p'.split())
>          for f, (m, args, msg) in actionbyfile.iteritems():

future refactoring opportunity! -- this is incredibly ugly, but it's not your fault.

> sparse.py:490
> +    typeactions = dict((m, [])
> +                       for m in 'a f g am cd dc r dm dg m e k p'.split())
>      for f, (m, args, msg) in actions.iteritems():

Another future refactoring opportunity.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D776

To: mbthomas, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel


More information about the Mercurial-devel mailing list