1278 |
1278 |
1279 if editor: |
1279 if editor: |
1280 cctx._text = editor(self, cctx, subs) |
1280 cctx._text = editor(self, cctx, subs) |
1281 edited = (text != cctx._text) |
1281 edited = (text != cctx._text) |
1282 |
1282 |
|
1283 # Save commit message in case this transaction gets rolled back |
|
1284 # (e.g. by a pretxncommit hook). Leave the content alone on |
|
1285 # the assumption that the user will use the same editor again. |
|
1286 msgfn = self.savecommitmessage(cctx._text) |
|
1287 |
1283 # commit subs and write new state |
1288 # commit subs and write new state |
1284 if subs: |
1289 if subs: |
1285 for s in sorted(commitsubs): |
1290 for s in sorted(commitsubs): |
1286 sub = wctx.sub(s) |
1291 sub = wctx.sub(s) |
1287 self.ui.status(_('committing subrepository %s\n') % |
1292 self.ui.status(_('committing subrepository %s\n') % |
1288 subrepo.subrelpath(sub)) |
1293 subrepo.subrelpath(sub)) |
1289 sr = sub.commit(cctx._text, user, date) |
1294 sr = sub.commit(cctx._text, user, date) |
1290 newstate[s] = (newstate[s][0], sr) |
1295 newstate[s] = (newstate[s][0], sr) |
1291 subrepo.writestate(self, newstate) |
1296 subrepo.writestate(self, newstate) |
1292 |
|
1293 # Save commit message in case this transaction gets rolled back |
|
1294 # (e.g. by a pretxncommit hook). Leave the content alone on |
|
1295 # the assumption that the user will use the same editor again. |
|
1296 msgfn = self.savecommitmessage(cctx._text) |
|
1297 |
1297 |
1298 p1, p2 = self.dirstate.parents() |
1298 p1, p2 = self.dirstate.parents() |
1299 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') |
1299 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') |
1300 try: |
1300 try: |
1301 self.hook("precommit", throw=True, parent1=hookp1, |
1301 self.hook("precommit", throw=True, parent1=hookp1, |