D775: commands: update the resolve command to handle path conflicts

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


ryanmce accepted this revision.
ryanmce added a comment.


  This looks fine to me. Some future cleanup opportunities but this fits the current style just fine.

INLINE COMMENTS

> commands.py:4273-4275
>              l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved',
> +                              'pu': 'unresolved', 'pr': 'resolved',
>                                'd': 'driverresolved'}[ms[f]]

In a future patch, we may want to refactor this so we're not instantiating the dict over and over (I don't know if python is optimizing this, but it seems "bad" to have it in a loop).

> commands.py:4277-4280
> +            # Set key based on merge state.  Unresolved path conflicts show
> +            # as 'P'.  Resolved path conflicts show as 'R', the same as normal
> +            # resolved conflicts.
> +            key = {'pu': 'P', 'pr': 'R'}.get(ms[f], ms[f].upper())

In another future refactor, consider making the key and label into a tuple in the dict:

  {
     'u': ('unresolved', 'U'),
     ...
     'pr': ('resolved', 'R'),
     ...
  }

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list