[PATCH 1 of 5 RFC] phases: use constants for phase values
Gregory Szorc
gregory.szorc at gmail.com
Tue Feb 16 02:04:48 UTC 2016
This one isn't radical and could be queued without much thought.
On Mon, Feb 15, 2016 at 6:03 PM, Gregory Szorc <gregory.szorc at gmail.com>
wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1455583792 28800
> # Mon Feb 15 16:49:52 2016 -0800
> # Node ID 8449ef66f732a71008dc887ffd6efbfb6dc64ee0
> # Parent 638dcaf3874940349d04f3369ddddc05fd9d5388
> phases: use constants for phase values
>
> Magic numbers hinder readability.
>
> diff --git a/mercurial/phases.py b/mercurial/phases.py
> --- a/mercurial/phases.py
> +++ b/mercurial/phases.py
> @@ -430,21 +430,21 @@ def analyzeremotephases(repo, subset, ro
> # build list from dictionary
> draftroots = []
> nodemap = repo.changelog.nodemap # to filter unknown nodes
> for nhex, phase in roots.iteritems():
> if nhex == 'publishing': # ignore data related to publish option
> continue
> node = bin(nhex)
> phase = int(phase)
> - if phase == 0:
> + if phase == public:
> if node != nullid:
> repo.ui.warn(_('ignoring inconsistent public root'
> ' from remote: %s\n') % nhex)
> - elif phase == 1:
> + elif phase == draft:
> if node in nodemap:
> draftroots.append(node)
> else:
> repo.ui.warn(_('ignoring unexpected root from remote: %i
> %s\n')
> % (phase, nhex))
> # compute heads
> publicheads = newheads(repo, subset, draftroots)
> return publicheads, draftroots
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160215/10e7ff0e/attachment-0002.html>
More information about the Mercurial-devel
mailing list