Bug 3680 - bookmark exchange crash when old changeset have successors unknown locally
Summary: bookmark exchange crash when old changeset have successors unknown locally
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: evolution (show other bugs)
Version: earlier
Hardware: PC Linux
: normal bug
Assignee: Pierre-Yves David
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-24 11:09 UTC by Pierre-Yves David
Modified: 2017-11-01 18:05 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Yves David 2012-10-24 11:09 UTC
When the old position of a bookmark have successors unknown of the local repo, the exchange (push or pull) crash on a key error (for the unknown node). The error is raise by validdest.

This is cause by "%ln" revset expecting all node to exist locally
Comment 1 Pierre-Yves David 2012-10-24 11:21 UTC
This could be easily solved by adding a `succs.intersection_update(known)` step in the function with known being the set of nodes in the repo.

however the `know` set can't be easily built using `known = set(repo.changelog.nodemap)` because `nodemap` is actually a C `index` object. Iteration over such object yield full index entry, not just node.

The quick and dirty approach is:

         if util.safehasattr(nm, 'nodemap'): # node map is C version of the index    
             known = set(entry[7] for entry in nm)
         else: 
             known = set(nm)

The other one would be to add a `keys()` method on `index` object (and use it to
build the set)
Comment 2 Augie Fackler 2012-10-24 11:33 UTC
I noticed this on my for-mpm repo but didn't have time to diagnose. It's pretty annoying.
Comment 3 HG Bot 2012-10-27 18:13 UTC
Fixed by http://selenic.com/repo/hg/rev/daf32ebfde6b
Pierre-Yves David <pierre-yves.david@logilab.fr>
bookmark: prevent crashing when a successor is unknown locally (issue3680)

The `%ln` revset substitution does not accept unknown node. We prune unknown
node from potential successors before computing descendants.

This have no impact on the result of this function.

- Descendants of unknown changeset as unknown,
- all successors of unknown changesets are already return by the call who
  returned those same unknown changesets,
- unknown changesets are never a valid destination for a bookmark.

(please test the fix)