--- a/hgext/obsolete.py Wed Aug 08 15:40:09 2012 +0200
+++ b/hgext/obsolete.py Wed Aug 08 16:51:45 2012 +0200
@@ -988,35 +988,28 @@
# targetrev. If a source revision is mapped to targetrev
# or to another rebased revision, it must have been
# removed.
- targetrev = repo[repo._rebasetarget].rev()
- newrevs = set([targetrev])
- replacements = {}
- for rev, newrev in sorted(repo._rebasestate.items()):
- oldnode = repo[rev].node()
- if newrev not in newrevs:
- newnode = repo[newrev].node()
- newrevs.add(newrev)
- else:
- newnode = nullid
- replacements[oldnode] = newnode
-
+ markers = []
if kwargs.get('collapse'):
- newnodes = set(n for n in replacements.values() if n != nullid)
- if newnodes:
- # Collapsing into more than one revision?
- assert len(newnodes) == 1, newnodes
- newnode = newnodes.pop()
- markers = [(repo[r], (repo[newnode],))
- for r in replacements]
+ # collapse assume revision disapear because they are all
+ # in the created revision
+ newrevs = set(repo._rebasestate.values())
+ newrevs.remove(repo._rebasetarget)
+ if newrevs:
+ # we create new revision.
+ # A single one by --collapse design
+ assert len(newrevs) == 1
+ new = tuple(repo[n] for n in newrevs)
else:
- newnode = nullid
- markers = [(repo[r], ())
- for r in replacements]
- createmarkers(repo, markers)
- elif replacements:
- markers = [(repo[o], (() if n == nullid else (repo[n],)))
- for o, n in replacements.iteritems()]
- createmarkers(repo, markers)
+ # every body died. no new changeset created
+ new = (repo[repo._rebasetarget],)
+ for rev, newrev in sorted(repo._rebasestate.items()):
+ markers.append((repo[rev], new))
+ else:
+ # no collapse assume revision disapear because they are
+ # contained in parent
+ for rev, newrev in sorted(repo._rebasestate.items()):
+ markers.append((repo[rev], (repo[newrev],)))
+ createmarkers(repo, markers)
return res
finally:
l.release()