##// END OF EJS Templates
fix 'convert' with single commit repositories...
Hollis Blanchard -
r4719:1069205a default
parent child Browse files
Show More
@@ -60,6 +60,8 b' class convert(object):'
60 self.authorfile = self.dest.authorfile()
60 self.authorfile = self.dest.authorfile()
61
61
62 def walktree(self, heads):
62 def walktree(self, heads):
63 '''Return a mapping that identifies the uncommitted parents of every
64 uncommitted changeset.'''
63 visit = heads
65 visit = heads
64 known = {}
66 known = {}
65 parents = {}
67 parents = {}
@@ -69,13 +71,16 b' class convert(object):'
69 known[n] = 1
71 known[n] = 1
70 self.commitcache[n] = self.source.getcommit(n)
72 self.commitcache[n] = self.source.getcommit(n)
71 cp = self.commitcache[n].parents
73 cp = self.commitcache[n].parents
74 parents[n] = []
72 for p in cp:
75 for p in cp:
73 parents.setdefault(n, []).append(p)
76 parents[n].append(p)
74 visit.append(p)
77 visit.append(p)
75
78
76 return parents
79 return parents
77
80
78 def toposort(self, parents):
81 def toposort(self, parents):
82 '''Return an ordering such that every uncommitted changeset is
83 preceeded by all its uncommitted ancestors.'''
79 visit = parents.keys()
84 visit = parents.keys()
80 seen = {}
85 seen = {}
81 children = {}
86 children = {}
@@ -84,13 +89,13 b' class convert(object):'
84 n = visit.pop(0)
89 n = visit.pop(0)
85 if n in seen: continue
90 if n in seen: continue
86 seen[n] = 1
91 seen[n] = 1
87 pc = 0
92 # Ensure that nodes without parents are present in the 'children'
88 if n in parents:
93 # mapping.
89 for p in parents[n]:
94 children.setdefault(n, [])
90 if p not in self.map: pc += 1
95 for p in parents[n]:
96 if not p in self.map:
91 visit.append(p)
97 visit.append(p)
92 children.setdefault(p, []).append(n)
98 children.setdefault(p, []).append(n)
93 if not pc: root = n
94
99
95 s = []
100 s = []
96 removed = {}
101 removed = {}
General Comments 0
You need to be logged in to leave comments. Login now