##// END OF EJS Templates
graphmod: safer code when a changeset has two identical parents...
Nicolas Dumazet -
r12951:101366ad stable
parent child Browse files
Show More
@@ -32,7 +32,7 b' def revisions(repo, start, stop):'
32 cur = start
32 cur = start
33 while cur >= stop:
33 while cur >= stop:
34 ctx = repo[cur]
34 ctx = repo[cur]
35 parents = [p.rev() for p in ctx.parents() if p.rev() != nullrev]
35 parents = set([p.rev() for p in ctx.parents() if p.rev() != nullrev])
36 yield (cur, CHANGESET, ctx, sorted(parents))
36 yield (cur, CHANGESET, ctx, sorted(parents))
37 cur -= 1
37 cur -= 1
38
38
@@ -47,7 +47,7 b' def filerevs(repo, path, start, stop, li'
47 count = 0
47 count = 0
48 while filerev >= 0 and rev > stop:
48 while filerev >= 0 and rev > stop:
49 fctx = repo.filectx(path, fileid=filerev)
49 fctx = repo.filectx(path, fileid=filerev)
50 parents = [f.linkrev() for f in fctx.parents() if f.path() == path]
50 parents = set([f.linkrev() for f in fctx.parents() if f.path() == path])
51 rev = fctx.rev()
51 rev = fctx.rev()
52 if rev <= start:
52 if rev <= start:
53 yield (rev, CHANGESET, fctx.changectx(), sorted(parents))
53 yield (rev, CHANGESET, fctx.changectx(), sorted(parents))
@@ -65,7 +65,7 b' def nodes(repo, nodes):'
65 include = set(nodes)
65 include = set(nodes)
66 for node in nodes:
66 for node in nodes:
67 ctx = repo[node]
67 ctx = repo[node]
68 parents = [p.rev() for p in ctx.parents() if p.node() in include]
68 parents = set([p.rev() for p in ctx.parents() if p.node() in include])
69 yield (ctx.rev(), CHANGESET, ctx, sorted(parents))
69 yield (ctx.rev(), CHANGESET, ctx, sorted(parents))
70
70
71 def colored(dag):
71 def colored(dag):
@@ -887,3 +887,39 b' File + limit + -ra:b, b < tip, (b - a) <'
887 | | summary: (33) head
887 | | summary: (33) head
888 | |
888 | |
889
889
890 Do not crash or produce strange graphs if history is buggy
891
892 $ commit 36 "buggy merge: identical parents" 35 35
893 $ hg glog -l5
894 @ changeset: 36:95fa8febd08a
895 | tag: tip
896 | parent: 35:9159c3644c5e
897 | parent: 35:9159c3644c5e
898 | user: test
899 | date: Thu Jan 01 00:00:36 1970 +0000
900 | summary: (36) buggy merge: identical parents
901 |
902 o changeset: 35:9159c3644c5e
903 | user: test
904 | date: Thu Jan 01 00:00:00 1970 +0000
905 | summary: 0
906 |
907 o changeset: 34:fea3ac5810e0
908 | parent: 32:d06dffa21a31
909 | user: test
910 | date: Thu Jan 01 00:00:34 1970 +0000
911 | summary: (34) head
912 |
913 | o changeset: 33:68608f5145f9
914 | | parent: 18:1aa84d96232a
915 | | user: test
916 | | date: Thu Jan 01 00:00:33 1970 +0000
917 | | summary: (33) head
918 | |
919 o | changeset: 32:d06dffa21a31
920 |\ \ parent: 27:886ed638191b
921 | | | parent: 31:621d83e11f67
922 | | | user: test
923 | | | date: Thu Jan 01 00:00:32 1970 +0000
924 | | | summary: (32) expand
925 | | |
General Comments 0
You need to be logged in to leave comments. Login now