1268 |
1268 |
1269 if editor: |
1269 if editor: |
1270 cctx._text = editor(self, cctx, subs) |
1270 cctx._text = editor(self, cctx, subs) |
1271 edited = (text != cctx._text) |
1271 edited = (text != cctx._text) |
1272 |
1272 |
|
1273 # Save commit message in case this transaction gets rolled back |
|
1274 # (e.g. by a pretxncommit hook). Leave the content alone on |
|
1275 # the assumption that the user will use the same editor again. |
|
1276 msgfn = self.savecommitmessage(cctx._text) |
|
1277 |
1273 # commit subs and write new state |
1278 # commit subs and write new state |
1274 if subs: |
1279 if subs: |
1275 for s in sorted(commitsubs): |
1280 for s in sorted(commitsubs): |
1276 sub = wctx.sub(s) |
1281 sub = wctx.sub(s) |
1277 self.ui.status(_('committing subrepository %s\n') % |
1282 self.ui.status(_('committing subrepository %s\n') % |
1278 subrepo.subrelpath(sub)) |
1283 subrepo.subrelpath(sub)) |
1279 sr = sub.commit(cctx._text, user, date) |
1284 sr = sub.commit(cctx._text, user, date) |
1280 newstate[s] = (newstate[s][0], sr) |
1285 newstate[s] = (newstate[s][0], sr) |
1281 subrepo.writestate(self, newstate) |
1286 subrepo.writestate(self, newstate) |
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 |
1287 |
1288 p1, p2 = self.dirstate.parents() |
1288 p1, p2 = self.dirstate.parents() |
1289 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') |
1289 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') |
1290 try: |
1290 try: |
1291 self.hook("precommit", throw=True, parent1=hookp1, |
1291 self.hook("precommit", throw=True, parent1=hookp1, |