##// END OF EJS Templates
Add timestamp field to export format. Make import and mq use it.
Danek Duvall -
r2299:dacf718e default
parent child Browse files
Show More
@@ -102,6 +102,7 b' class queue:'
102 message = []
102 message = []
103 comments = []
103 comments = []
104 user = None
104 user = None
105 date = None
105 format = None
106 format = None
106 subject = None
107 subject = None
107 diffstart = 0
108 diffstart = 0
@@ -119,6 +120,8 b' class queue:'
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
@@ -149,7 +152,7 b' class queue:'
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
@@ -179,7 +182,7 b' class queue:'
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)
@@ -267,7 +270,7 b' class queue:'
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
@@ -326,7 +329,7 b' class queue:'
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:
@@ -716,7 +719,7 b' class queue:'
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:
@@ -1392,6 +1392,7 b' def doexport(ui, repo, changeset, seqno,'
1392
1392
1393 fp.write("# HG changeset patch\n")
1393 fp.write("# HG changeset patch\n")
1394 fp.write("# User %s\n" % change[1])
1394 fp.write("# User %s\n" % change[1])
1395 fp.write("# Timestamp %d %d\n" % (change[2][0], change[2][1]))
1395 fp.write("# Node ID %s\n" % hex(node))
1396 fp.write("# Node ID %s\n" % hex(node))
1396 fp.write("# Parent %s\n" % hex(prev))
1397 fp.write("# Parent %s\n" % hex(prev))
1397 if len(parents) > 1:
1398 if len(parents) > 1:
@@ -1687,6 +1688,7 b' def import_(ui, repo, patch1, *patches, '
1687
1688
1688 message = []
1689 message = []
1689 user = None
1690 user = None
1691 date = None
1690 hgpatch = False
1692 hgpatch = False
1691 for line in file(pf):
1693 for line in file(pf):
1692 line = line.rstrip()
1694 line = line.rstrip()
@@ -1703,6 +1705,8 b' def import_(ui, repo, patch1, *patches, '
1703 if line.startswith("# User "):
1705 if line.startswith("# User "):
1704 user = line[7:]
1706 user = line[7:]
1705 ui.debug(_('User: %s\n') % user)
1707 ui.debug(_('User: %s\n') % user)
1708 elif line.startswith("# Timestamp "):
1709 date = line[12:]
1706 elif not line.startswith("# ") and line:
1710 elif not line.startswith("# ") and line:
1707 message.append(line)
1711 message.append(line)
1708 hgpatch = False
1712 hgpatch = False
@@ -1723,7 +1727,7 b' def import_(ui, repo, patch1, *patches, '
1723
1727
1724 if len(files) > 0:
1728 if len(files) > 0:
1725 addremove_lock(ui, repo, files, {})
1729 addremove_lock(ui, repo, files, {})
1726 repo.commit(files, message, user)
1730 repo.commit(files, message, user, date)
1727
1731
1728 def incoming(ui, repo, source="default", **opts):
1732 def incoming(ui, repo, source="default", **opts):
1729 """show new changesets found in source
1733 """show new changesets found in source
General Comments 0
You need to be logged in to leave comments. Login now