comparison hgext/mq.py @ 22521:3f948469bac0

mq: write '# Parent ' lines with two spaces like export does (BC) This aligns "Parent" node IDs with "Node ID" node IDs.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 24 Sep 2014 01:36:44 +0200
parents 9d4ebb75de53
children 382c2be610dc
comparison
equal deleted inserted replaced
22520:9d4ebb75de53 22521:3f948469bac0
148 if line.startswith("# User "): 148 if line.startswith("# User "):
149 user = line[7:] 149 user = line[7:]
150 elif line.startswith("# Date "): 150 elif line.startswith("# Date "):
151 date = line[7:] 151 date = line[7:]
152 elif line.startswith("# Parent "): 152 elif line.startswith("# Parent "):
153 parent = line[9:].lstrip() 153 parent = line[9:].lstrip() # handle double trailing space
154 elif line.startswith("# Branch "): 154 elif line.startswith("# Branch "):
155 branch = line[9:] 155 branch = line[9:]
156 elif line.startswith("# Node ID "): 156 elif line.startswith("# Node ID "):
157 nodeid = line[10:] 157 nodeid = line[10:]
158 elif not line.startswith("# ") and line: 158 elif not line.startswith("# ") and line:
230 tmp = ['# HG changeset patch', '# Date ' + date, ''] 230 tmp = ['# HG changeset patch', '# Date ' + date, '']
231 self.comments = tmp + self.comments 231 self.comments = tmp + self.comments
232 self.date = date 232 self.date = date
233 233
234 def setparent(self, parent): 234 def setparent(self, parent):
235 if not self.updateheader(['# Parent '], parent): 235 if not (self.updateheader(['# Parent '], parent) or
236 self.updateheader(['# Parent '], parent)):
236 try: 237 try:
237 patchheaderat = self.comments.index('# HG changeset patch') 238 patchheaderat = self.comments.index('# HG changeset patch')
238 self.comments.insert(patchheaderat + 1, '# Parent ' + parent) 239 self.comments.insert(patchheaderat + 1, '# Parent ' + parent)
239 except ValueError: 240 except ValueError:
240 pass 241 pass
241 self.parent = parent 242 self.parent = parent
242 243
243 def setmessage(self, message): 244 def setmessage(self, message):
1079 p.write("# HG changeset patch\n") 1080 p.write("# HG changeset patch\n")
1080 if user: 1081 if user:
1081 p.write("# User " + user + "\n") 1082 p.write("# User " + user + "\n")
1082 if date: 1083 if date:
1083 p.write("# Date %s %s\n" % date) 1084 p.write("# Date %s %s\n" % date)
1084 p.write("# Parent " 1085 p.write("# Parent "
1085 + hex(repo[None].p1().node()) + "\n") 1086 + hex(repo[None].p1().node()) + "\n")
1086 1087
1087 defaultmsg = "[mq]: %s" % patchfn 1088 defaultmsg = "[mq]: %s" % patchfn
1088 editor = cmdutil.getcommiteditor(editform=editform) 1089 editor = cmdutil.getcommiteditor(editform=editform)
1089 if edit: 1090 if edit: