D7069: copies: simplify the handling of merges

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Oct 14 12:54:31 EDT 2019


This revision is now accepted and ready to land.
martinvonz added inline comments.
martinvonz accepted this revision.

INLINE COMMENTS

> copies.py:285
>      roots = set(children) - set(missingrevs)
> -    # 'work' contains 3-tuples of a (revision number, parent number, copies).
> -    # The parent number is only used for knowing which parent the copies dict
> -    # came from.
> -    # NOTE: To reduce costly copying the 'copies' dicts, we reuse the same
> -    # instance for *one* of the child nodes (the last one). Once an instance
> -    # has been put on the queue, it is thus no longer safe to modify it.
> -    # Conversely, it *is* safe to modify an instance popped off the queue.
> -    work = [(r, 1, {}) for r in roots]
> +    work = [r for r in roots]
> +    all_copies = dict((r, {}) for r in roots)

`list(roots)` is simpler and clearer to me

> copies.py:286
> +    work = [r for r in roots]
> +    all_copies = dict((r, {}) for r in roots)
>      heapq.heapify(work)

and here `{r: {} for r in roots}` is simpler and clearer to me

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7069/new/

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

To: marmoute, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list