Mercurial > hg > hg-fastimport
comparison hgfastimport/hgimport.py @ 46:93c2b1e832bd
Remove commented-out cruft.
| author | Greg Ward <greg-hg@gerg.ca> |
|---|---|
| date | Sun, 10 May 2009 14:16:02 -0400 |
| parents | 61ff7b929cea |
| children | 7ff36dc9f0b1 |
comparison
equal
deleted
inserted
replaced
| 45:783890f8a6fb | 46:93c2b1e832bd |
|---|---|
| 111 | 111 |
| 112 if cmd.from_: | 112 if cmd.from_: |
| 113 first_parent = self.committish_rev(cmd.from_) | 113 first_parent = self.committish_rev(cmd.from_) |
| 114 else: | 114 else: |
| 115 first_parent = self.branch_map.get(cmd.ref, nullrev) | 115 first_parent = self.branch_map.get(cmd.ref, nullrev) |
| 116 #self.ui.write("Bing\n") | |
| 117 if cmd.merges: | 116 if cmd.merges: |
| 118 #self.ui.write("foo") | |
| 119 if len(cmd.merges) > 1: | 117 if len(cmd.merges) > 1: |
| 120 raise NotImplementedError("Can't handle more than two parents") | 118 raise NotImplementedError("Can't handle more than two parents") |
| 121 second_parent = self.committish_rev(cmd.merges[0]) | 119 second_parent = self.committish_rev(cmd.merges[0]) |
| 122 #self.ui.write("Second parent: %s\n" % second_parent) | |
| 123 else: | 120 else: |
| 124 second_parent = nullrev | 121 second_parent = nullrev |
| 125 | 122 |
| 126 if first_parent is nullrev and second_parent is not nullrev: | 123 if first_parent is nullrev and second_parent is not nullrev: |
| 127 # First commit on a new branch that has 'merge' but no 'from': | 124 # First commit on a new branch that has 'merge' but no 'from': |
| 142 # Update to the first parent | 139 # Update to the first parent |
| 143 mercurial.hg.clean(self.repo, self.repo.lookup(first_parent)) | 140 mercurial.hg.clean(self.repo, self.repo.lookup(first_parent)) |
| 144 mercurial.commands.debugsetparents( | 141 mercurial.commands.debugsetparents( |
| 145 self.ui, self.repo, first_parent, second_parent) | 142 self.ui, self.repo, first_parent, second_parent) |
| 146 | 143 |
| 147 #self.ui.write("Bing\n") | |
| 148 if cmd.ref == "refs/heads/master": | 144 if cmd.ref == "refs/heads/master": |
| 149 branch = "default" | 145 branch = "default" |
| 150 elif fixup and first_parent is not nullrev: | 146 elif fixup and first_parent is not nullrev: |
| 151 # If this is a fixup commit, pretend it happened on the same branch | 147 # If this is a fixup commit, pretend it happened on the same branch |
| 152 # as its first parent. (We don't want a Mercurial named branch | 148 # as its first parent. (We don't want a Mercurial named branch |
| 153 # called "TAG.FIXUP" in the output repository.) | 149 # called "TAG.FIXUP" in the output repository.) |
| 154 branch = self.repo.changectx(first_parent).branch() | 150 branch = self.repo.changectx(first_parent).branch() |
| 155 else: | 151 else: |
| 156 branch = cmd.ref[len("refs/heads/"):] | 152 branch = cmd.ref[len("refs/heads/"):] |
| 157 #self.ui.write("Branch: %s\n" % branch) | |
| 158 self.repo.dirstate.setbranch(branch) | 153 self.repo.dirstate.setbranch(branch) |
| 159 #self.ui.write("Bing\n") | |
| 160 #print "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" | |
| 161 commit_handler = HgImportCommitHandler( | 154 commit_handler = HgImportCommitHandler( |
| 162 self, cmd, self.ui, self.repo, **self.opts) | 155 self, cmd, self.ui, self.repo, **self.opts) |
| 163 commit_handler.process() | 156 commit_handler.process() |
| 164 #print "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" | |
| 165 #self.ui.write(cmd.dump_str(verbose=True)) | |
| 166 | 157 |
| 167 # in case we are converting from git or bzr, prefer author but | 158 # in case we are converting from git or bzr, prefer author but |
| 168 # fallback to committer (committer is required, author is | 159 # fallback to committer (committer is required, author is |
| 169 # optional) | 160 # optional) |
| 170 userinfo = cmd.author or cmd.committer | 161 userinfo = cmd.author or cmd.committer |
| 187 self.mark_map[":" + cmd.mark] = rev | 178 self.mark_map[":" + cmd.mark] = rev |
| 188 if not fixup: | 179 if not fixup: |
| 189 self.branch_map[cmd.ref] = rev | 180 self.branch_map[cmd.ref] = rev |
| 190 self.last_commit = cmd | 181 self.last_commit = cmd |
| 191 self.ui.write("Done commit of rev %d\n" % rev) | 182 self.ui.write("Done commit of rev %d\n" % rev) |
| 192 #self.ui.write("%s\n" % self.mark_map) | |
| 193 | 183 |
| 194 def convert_date(self, c): | 184 def convert_date(self, c): |
| 195 res = (int(c[2]), int(c[3])) | 185 res = (int(c[2]), int(c[3])) |
| 196 #print c, res | 186 #print c, res |
| 197 #print type((0, 0)), type(res), len(res), type(res) is type((0, 0)) | 187 #print type((0, 0)), type(res), len(res), type(res) is type((0, 0)) |
