##// END OF EJS Templates
Add ability to parse branch information to hg import
Eric Hopper -
r4443:eff2eefd default
parent child Browse files
Show More
@@ -1516,10 +1516,10 b' def import_(ui, repo, patch1, *patches, '
1516
1516
1517 if pf == '-':
1517 if pf == '-':
1518 ui.status(_("applying patch from stdin\n"))
1518 ui.status(_("applying patch from stdin\n"))
1519 tmpname, message, user, date, nodeid, p1, p2 = patch.extract(ui, sys.stdin)
1519 tmpname, message, user, date, branch, nodeid, p1, p2 = patch.extract(ui, sys.stdin)
1520 else:
1520 else:
1521 ui.status(_("applying %s\n") % p)
1521 ui.status(_("applying %s\n") % p)
1522 tmpname, message, user, date, nodeid, p1, p2 = patch.extract(ui, file(pf))
1522 tmpname, message, user, date, branch, nodeid, p1, p2 = patch.extract(ui, file(pf))
1523
1523
1524 if tmpname is None:
1524 if tmpname is None:
1525 raise util.Abort(_('no diffs found'))
1525 raise util.Abort(_('no diffs found'))
@@ -55,6 +55,7 b' def extract(ui, fileobj):'
55 # should try to parse msg['Date']
55 # should try to parse msg['Date']
56 date = None
56 date = None
57 nodeid = None
57 nodeid = None
58 branch = None
58 parents = []
59 parents = []
59
60
60 if message:
61 if message:
@@ -99,6 +100,8 b' def extract(ui, fileobj):'
99 ui.debug('From: %s\n' % user)
100 ui.debug('From: %s\n' % user)
100 elif line.startswith("# Date "):
101 elif line.startswith("# Date "):
101 date = line[7:]
102 date = line[7:]
103 elif line.startswith("# Branch "):
104 branch = line[9:]
102 elif line.startswith("# Node ID "):
105 elif line.startswith("# Node ID "):
103 nodeid = line[10:]
106 nodeid = line[10:]
104 elif line.startswith("# Parent "):
107 elif line.startswith("# Parent "):
@@ -123,10 +126,10 b' def extract(ui, fileobj):'
123 tmpfp.close()
126 tmpfp.close()
124 if not diffs_seen:
127 if not diffs_seen:
125 os.unlink(tmpname)
128 os.unlink(tmpname)
126 return None, message, user, date, None, None, None
129 return None, message, user, date, branch, None, None, None
127 p1 = parents and parents.pop(0) or None
130 p1 = parents and parents.pop(0) or None
128 p2 = parents and parents.pop(0) or None
131 p2 = parents and parents.pop(0) or None
129 return tmpname, message, user, date, nodeid, p1, p2
132 return tmpname, message, user, date, branch, nodeid, p1, p2
130
133
131 GP_PATCH = 1 << 0 # we have to run patch
134 GP_PATCH = 1 << 0 # we have to run patch
132 GP_FILTER = 1 << 1 # there's some copy/rename operation
135 GP_FILTER = 1 << 1 # there's some copy/rename operation
General Comments 0
You need to be logged in to leave comments. Login now