diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -102,6 +102,7 @@ class queue: message = [] comments = [] user = None + date = None format = None subject = None diffstart = 0 @@ -119,6 +120,8 @@ class queue: # parse values when importing the result of an hg export if line.startswith("# User "): user = line[7:] + elif line.startswith("# Timestamp "): + date = line[12:] elif not line.startswith("# ") and line: message.append(line) format = None @@ -149,7 +152,7 @@ class queue: if format and format.startswith("tag") and subject: message.insert(0, "") message.insert(0, subject) - return (message, comments, user, diffstart > 1) + return (message, comments, user, date, diffstart > 1) def mergeone(self, repo, mergeq, head, patch, rev, wlock): # first try just applying the patch @@ -179,7 +182,7 @@ class queue: self.ui.warn("repo commit failed\n") sys.exit(1) try: - message, comments, user, patchfound = mergeq.readheaders(patch) + message, comments, user, date, patchfound = mergeq.readheaders(patch) except: self.ui.warn("Unable to read %s\n" % patch) sys.exit(1) @@ -267,7 +270,7 @@ class queue: pf = os.path.join(patchdir, patch) try: - message, comments, user, patchfound = self.readheaders(patch) + message, comments, user, date, patchfound = self.readheaders(patch) except: self.ui.warn("Unable to read %s\n" % pf) err = 1 @@ -326,7 +329,7 @@ class queue: if len(files) > 0: commands.addremove_lock(self.ui, repo, files, opts={}, wlock=wlock) - n = repo.commit(files, message, user, force=1, lock=lock, + n = repo.commit(files, message, user, date, force=1, lock=lock, wlock=wlock) if n == None: @@ -716,7 +719,7 @@ class queue: top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo, top) - message, comments, user, patchfound = self.readheaders(patch) + message, comments, user, date, patchfound = self.readheaders(patch) patchf = self.opener(patch, "w") if comments: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1392,6 +1392,7 @@ def doexport(ui, repo, changeset, seqno, fp.write("# HG changeset patch\n") fp.write("# User %s\n" % change[1]) + fp.write("# Timestamp %d %d\n" % (change[2][0], change[2][1])) fp.write("# Node ID %s\n" % hex(node)) fp.write("# Parent %s\n" % hex(prev)) if len(parents) > 1: @@ -1687,6 +1688,7 @@ def import_(ui, repo, patch1, *patches, message = [] user = None + date = None hgpatch = False for line in file(pf): line = line.rstrip() @@ -1703,6 +1705,8 @@ def import_(ui, repo, patch1, *patches, if line.startswith("# User "): user = line[7:] ui.debug(_('User: %s\n') % user) + elif line.startswith("# Timestamp "): + date = line[12:] elif not line.startswith("# ") and line: message.append(line) hgpatch = False @@ -1723,7 +1727,7 @@ def import_(ui, repo, patch1, *patches, if len(files) > 0: addremove_lock(ui, repo, files, {}) - repo.commit(files, message, user) + repo.commit(files, message, user, date) def incoming(ui, repo, source="default", **opts): """show new changesets found in source