117 continue |
118 continue |
118 elif format == "hgpatch": |
119 elif format == "hgpatch": |
119 # parse values when importing the result of an hg export |
120 # parse values when importing the result of an hg export |
120 if line.startswith("# User "): |
121 if line.startswith("# User "): |
121 user = line[7:] |
122 user = line[7:] |
|
123 elif line.startswith("# Timestamp "): |
|
124 date = line[12:] |
122 elif not line.startswith("# ") and line: |
125 elif not line.startswith("# ") and line: |
123 message.append(line) |
126 message.append(line) |
124 format = None |
127 format = None |
125 elif line == '# HG changeset patch': |
128 elif line == '# HG changeset patch': |
126 format = "hgpatch" |
129 format = "hgpatch" |
147 |
150 |
148 # make sure message isn't empty |
151 # make sure message isn't empty |
149 if format and format.startswith("tag") and subject: |
152 if format and format.startswith("tag") and subject: |
150 message.insert(0, "") |
153 message.insert(0, "") |
151 message.insert(0, subject) |
154 message.insert(0, subject) |
152 return (message, comments, user, diffstart > 1) |
155 return (message, comments, user, date, diffstart > 1) |
153 |
156 |
154 def mergeone(self, repo, mergeq, head, patch, rev, wlock): |
157 def mergeone(self, repo, mergeq, head, patch, rev, wlock): |
155 # first try just applying the patch |
158 # first try just applying the patch |
156 (err, n) = self.apply(repo, [ patch ], update_status=False, |
159 (err, n) = self.apply(repo, [ patch ], update_status=False, |
157 strict=True, merge=rev, wlock=wlock) |
160 strict=True, merge=rev, wlock=wlock) |
177 n = repo.commit(None, c[4], c[1], force=1, wlock=wlock) |
180 n = repo.commit(None, c[4], c[1], force=1, wlock=wlock) |
178 if n == None: |
181 if n == None: |
179 self.ui.warn("repo commit failed\n") |
182 self.ui.warn("repo commit failed\n") |
180 sys.exit(1) |
183 sys.exit(1) |
181 try: |
184 try: |
182 message, comments, user, patchfound = mergeq.readheaders(patch) |
185 message, comments, user, date, patchfound = mergeq.readheaders(patch) |
183 except: |
186 except: |
184 self.ui.warn("Unable to read %s\n" % patch) |
187 self.ui.warn("Unable to read %s\n" % patch) |
185 sys.exit(1) |
188 sys.exit(1) |
186 |
189 |
187 patchf = self.opener(patch, "w") |
190 patchf = self.opener(patch, "w") |
265 for patch in series: |
268 for patch in series: |
266 self.ui.warn("applying %s\n" % patch) |
269 self.ui.warn("applying %s\n" % patch) |
267 pf = os.path.join(patchdir, patch) |
270 pf = os.path.join(patchdir, patch) |
268 |
271 |
269 try: |
272 try: |
270 message, comments, user, patchfound = self.readheaders(patch) |
273 message, comments, user, date, patchfound = self.readheaders(patch) |
271 except: |
274 except: |
272 self.ui.warn("Unable to read %s\n" % pf) |
275 self.ui.warn("Unable to read %s\n" % pf) |
273 err = 1 |
276 err = 1 |
274 break |
277 break |
275 |
278 |
324 p1, p2 = repo.dirstate.parents() |
327 p1, p2 = repo.dirstate.parents() |
325 repo.dirstate.setparents(p1, merge) |
328 repo.dirstate.setparents(p1, merge) |
326 if len(files) > 0: |
329 if len(files) > 0: |
327 commands.addremove_lock(self.ui, repo, files, |
330 commands.addremove_lock(self.ui, repo, files, |
328 opts={}, wlock=wlock) |
331 opts={}, wlock=wlock) |
329 n = repo.commit(files, message, user, force=1, lock=lock, |
332 n = repo.commit(files, message, user, date, force=1, lock=lock, |
330 wlock=wlock) |
333 wlock=wlock) |
331 |
334 |
332 if n == None: |
335 if n == None: |
333 self.ui.warn("repo commit failed\n") |
336 self.ui.warn("repo commit failed\n") |
334 sys.exit(1) |
337 sys.exit(1) |
714 qp = self.qparents(repo) |
717 qp = self.qparents(repo) |
715 (top, patch) = self.applied[-1].split(':') |
718 (top, patch) = self.applied[-1].split(':') |
716 top = revlog.bin(top) |
719 top = revlog.bin(top) |
717 cparents = repo.changelog.parents(top) |
720 cparents = repo.changelog.parents(top) |
718 patchparent = self.qparents(repo, top) |
721 patchparent = self.qparents(repo, top) |
719 message, comments, user, patchfound = self.readheaders(patch) |
722 message, comments, user, date, patchfound = self.readheaders(patch) |
720 |
723 |
721 patchf = self.opener(patch, "w") |
724 patchf = self.opener(patch, "w") |
722 if comments: |
725 if comments: |
723 comments = "\n".join(comments) + '\n\n' |
726 comments = "\n".join(comments) + '\n\n' |
724 patchf.write(comments) |
727 patchf.write(comments) |