105 |
105 |
106 |
106 |
107 |
107 |
108 check saving last-message.txt |
108 check saving last-message.txt |
109 |
109 |
110 $ cat > $TESTDIR/abortfolding.py <<EOF |
110 $ cat > $TESTTMP/abortfolding.py <<EOF |
111 > from mercurial import util |
111 > from mercurial import util |
112 > def abortfolding(ui, repo, hooktype, **kwargs): |
112 > def abortfolding(ui, repo, hooktype, **kwargs): |
113 > ctx = repo[kwargs.get('node')] |
113 > ctx = repo[kwargs.get('node')] |
114 > if set(ctx.files()) == set(['c', 'd', 'f']): |
114 > if set(ctx.files()) == set(['c', 'd', 'f']): |
115 > return True # abort folding commit only |
115 > return True # abort folding commit only |
116 > ui.warn('allow non-folding commit\\n') |
116 > ui.warn('allow non-folding commit\\n') |
117 > EOF |
117 > EOF |
118 $ cat > .hg/hgrc <<EOF |
118 $ cat > .hg/hgrc <<EOF |
119 > [hooks] |
119 > [hooks] |
120 > pretxncommit.abortfolding = python:$TESTDIR/abortfolding.py:abortfolding |
120 > pretxncommit.abortfolding = python:$TESTTMP/abortfolding.py:abortfolding |
121 > EOF |
121 > EOF |
122 |
122 |
123 $ cat > $TESTDIR/editor.sh << EOF |
123 $ cat > $TESTTMP/editor.sh << EOF |
124 > echo "==== before editing" |
124 > echo "==== before editing" |
125 > cat \$1 |
125 > cat \$1 |
126 > echo "====" |
126 > echo "====" |
127 > echo "check saving last-message.txt" >> \$1 |
127 > echo "check saving last-message.txt" >> \$1 |
128 > EOF |
128 > EOF |
129 |
129 |
130 $ rm -f .hg/last-message.txt |
130 $ rm -f .hg/last-message.txt |
131 $ HGEDITOR="sh $TESTDIR/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle |
131 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle |
132 > pick 6de59d13424a f |
132 > pick 6de59d13424a f |
133 > fold 9c277da72c9b d |
133 > fold 9c277da72c9b d |
134 > EOF |
134 > EOF |
135 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
135 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
136 allow non-folding commit |
136 allow non-folding commit |