Commits

Augie Fackler committed 1ba9581

message: fix case when no change was actually made

Without this fix, such a case would result in the change being dropped
rather than preserved without mutation.

  • Participants
  • Parent commits 0e2d070

Comments (0)

Files changed (3)

File hg_histedit.py

     new = repo.commit(text=message, user=oldctx.user(), date=oldctx.date(),
                       extra=oldctx.extra())
     newctx = repo[new]
-    return newctx.parents()[0], [new], [oldctx.node()], []
+    if oldctx.node() != newctx.node():
+        return newctx, [new], [oldctx.node()], []
+    # We didn't make an edit, so just indicate no replaced nodes
+    return newctx, [new], [], []
+
 
 
 actiontable = {'p': pick,

File tests/test-histedit-edit

 echo % log after edit
 hg log --limit 1
 
+echo "% say we'll change the message, but don't."
+cat > ../edit.sh <<EOF
+#!/bin/sh
+cat \$1 | sed s/pick/mess/ > tmp
+mv tmp \$1
+EOF
+chmod +x ../edit.sh
+HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle
+hg status
+hg log --limit 1
+
 echo % modify the message
 cat > $EDITED <<EOF
 mess c38516e9ed62 f

File tests/test-histedit-edit.out

 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     f
 
+% say we'll change the message, but don't.
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+changeset:   5:c38516e9ed62
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     f
+
 % modify the message
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 changeset:   5:4d6a10bcf3e3
 tag:         tip
 user:        test