comparison contrib/convert-repo @ 431:dfc44f3f587c

convert-repo fixups -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 convert-repo fixups - - deal with octopus merge uniqueify parent list add a series of identical commits with "(octopus merge fixup)" - - add "committer" field from git to the commit message manifest hash: e33d802afe35edecfc5cc9b567def6db2b0cb885 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCubogywK+sNU5EO8RAkWgAJ9OVHeumKd/nRIfvS/nQ9eSbORqNgCgpBIE Dza0L59OSJHHmm3Dbp7ygds= =OEvJ -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 22 Jun 2005 11:21:04 -0800
parents c48d069163d6
children 9d785fd7deec
comparison
equal deleted inserted replaced
430:5b22029b5aa2 431:dfc44f3f587c
67 if n == "author": 67 if n == "author":
68 p = v.split() 68 p = v.split()
69 date = " ".join(p[-2:]) 69 date = " ".join(p[-2:])
70 author = " ".join(p[:-2]) 70 author = " ".join(p[:-2])
71 if author[0] == "<": author = author[1:-1] 71 if author[0] == "<": author = author[1:-1]
72 if n == "committer":
73 p = v.split()
74 date = " ".join(p[-2:])
75 committer = " ".join(p[:-2])
76 if committer[0] == "<": committer = committer[1:-1]
77 message += "\ncommitter: %s %s\n" % (committer, date)
72 if n == "parent": parents.append(v) 78 if n == "parent": parents.append(v)
73 return (parents, author, date, message) 79 return (parents, author, date, message)
74 80
75 class convert_mercurial: 81 class convert_mercurial:
76 def __init__(self, path): 82 def __init__(self, path):
93 self.repo.remove([f]) 99 self.repo.remove([f])
94 except: 100 except:
95 pass 101 pass
96 102
97 def putcommit(self, files, parents, author, dest, text): 103 def putcommit(self, files, parents, author, dest, text):
98 p1, p2 = "0"*40, "0"*40 104 if not parents: parents = ["0" * 40]
99 if len(parents) > 0: p1 = parents[0] 105 if len(parents) < 2: parents.append("0" * 40)
100 if len(parents) > 1: p2 = parents[1] 106
101 if len(parents) > 2: raise "the dreaded octopus merge!" 107 seen = {}
102 self.repo.rawcommit(files, text, author, dest, 108 pl = []
103 hg.bin(p1), hg.bin(p2)) 109 for p in parents:
104 110 if p not in seen:
105 return hg.hex(self.repo.changelog.tip()) 111 pl.append(p)
112 seen[p] = 1
113 parents = pl
114
115 p2 = parents.pop(0)
116 c = self.repo.changelog.count()
117 while parents:
118 p1 = p2
119 p2 = parents.pop(0)
120 self.repo.rawcommit(files, text, author, dest,
121 hg.bin(p1), hg.bin(p2))
122 text = "(octopus merge fixup)\n"
123
124 return hg.hex(self.repo.changelog.node(c))
106 125
107 class convert: 126 class convert:
108 def __init__(self, source, dest, mapfile): 127 def __init__(self, source, dest, mapfile):
109 self.source = source 128 self.source = source
110 self.dest = dest 129 self.dest = dest