Patchwork D7337: index: use `index.get_rev` in `repoview.pinnedrevs`

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2019, 4:25 p.m.
Message ID <differential-rev-PHID-DREV-zmyhq43y2tlatbgwtjft-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42942/
State Superseded
Headers show

Comments

phabricator - Nov. 8, 2019, 4:25 p.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We simplify the code in the process

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/repoview.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 8, 2019, 10:10 p.m.
indygreg added inline comments.

INLINE COMMENTS

> repoview.py:64
> +        pinned.update(rev(t[0]) for t in tags.values())
> +        pinned.discard(None)
>      return pinned

Why was `pinned.discard(None)` added?

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, #hg-reviewers
Cc: indygreg, mercurial-devel
phabricator - Nov. 8, 2019, 10:23 p.m.
This revision is now accepted and ready to land.
indygreg added inline comments.
indygreg accepted this revision.

INLINE COMMENTS

> indygreg wrote in repoview.py:64
> Why was `pinned.discard(None)` added?

Nevermind. This `get_rev()` can return `None`.

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
phabricator - Nov. 9, 2019, 12:17 a.m.
marmoute added inline comments.
marmoute marked 2 inline comments as done.

INLINE COMMENTS

> indygreg wrote in repoview.py:64
> Nevermind. This `get_rev()` can return `None`.

Yeah, it is simpler to filter out None at the end than to do a lookup before adding to the set.

REPOSITORY
  rHG Mercurial

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

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

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

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -59,8 +59,9 @@ 
     tags = {}
     tagsmod.readlocaltags(repo.ui, repo, tags, {})
     if tags:
-        rev, nodemap = cl.rev, cl.nodemap
-        pinned.update(rev(t[0]) for t in tags.values() if t[0] in nodemap)
+        rev = cl.index.get_rev
+        pinned.update(rev(t[0]) for t in tags.values())
+        pinned.discard(None)
     return pinned