comparison mercurial/commands.py @ 2299:dacf718e1d48

Add timestamp field to export format. Make import and mq use it.
author Danek Duvall <danek.duvall@sun.com>
date Wed, 17 May 2006 18:54:30 +0200
parents 3dc6f2501dbc
children 52b9b6751b2c
comparison
equal deleted inserted replaced
2297:936b615eb44e 2299:dacf718e1d48
1390 if fp != sys.stdout: 1390 if fp != sys.stdout:
1391 ui.note("%s\n" % fp.name) 1391 ui.note("%s\n" % fp.name)
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:
1398 fp.write("# Parent %s\n" % hex(parents[1])) 1399 fp.write("# Parent %s\n" % hex(parents[1]))
1399 fp.write(change[4].rstrip()) 1400 fp.write(change[4].rstrip())
1685 ui.status(_("applying %s\n") % patch) 1686 ui.status(_("applying %s\n") % patch)
1686 pf = os.path.join(d, patch) 1687 pf = os.path.join(d, patch)
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()
1693 if (not message and not hgpatch and 1695 if (not message and not hgpatch and
1694 mailre.match(line) and not opts['force']): 1696 mailre.match(line) and not opts['force']):
1701 elif hgpatch: 1703 elif hgpatch:
1702 # parse values when importing the result of an hg export 1704 # parse values when importing the result of an hg export
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
1709 elif line == '# HG changeset patch': 1713 elif line == '# HG changeset patch':
1710 hgpatch = True 1714 hgpatch = True
1721 1725
1722 files = util.patch(strip, pf, ui) 1726 files = util.patch(strip, pf, ui)
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
1730 1734
1731 Show new changesets found in the specified path/URL or the default 1735 Show new changesets found in the specified path/URL or the default