Patchwork [4,of,6] record: add tests for the curses recording interface

login
register
mail settings
Submitter Laurent Charignon
Date March 13, 2015, 9:21 p.m.
Message ID <2fdd632353a2381e88ed.1426281715@dev919.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8065/
State Accepted
Headers show

Comments

Laurent Charignon - March 13, 2015, 9:21 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1426196575 25200
#      Thu Mar 12 14:42:55 2015 -0700
# Node ID 2fdd632353a2381e88ed2572a4e691502adc5992
# Parent  0c3a80879d4ede76101bbe46d4a67a19a6e28608
record: add tests for the curses recording interface
Pierre-Yves David - March 13, 2015, 10:46 p.m.
On 03/13/2015 02:21 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1426196575 25200
> #      Thu Mar 12 14:42:55 2015 -0700
> # Node ID 2fdd632353a2381e88ed2572a4e691502adc5992
> # Parent  0c3a80879d4ede76101bbe46d4a67a19a6e28608
> record: add tests for the curses recording interface
>
> diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-commit-interactive-curses.t
> @@ -0,0 +1,183 @@
> +Set up a repo
> +
> +  $ cat <<EOF >> $HGRCPATH
> +  > [ui]
> +  > interactive = true
> +  > [experimental]
> +  > crecord = true
> +  > crecordTestMode = testModeCommands
> +  > EOF
> +
> +  $ hg init a
> +  $ cd a
> +
> +Comiting some changes but stopping on the way

Commiting ;-) (fixed locally)
Augie Fackler - March 14, 2015, 2 a.m.
On Fri, Mar 13, 2015 at 03:46:54PM -0700, Pierre-Yves David wrote:
>
>
> On 03/13/2015 02:21 PM, Laurent Charignon wrote:
> ># HG changeset patch
> ># User Laurent Charignon <lcharignon@fb.com>
> ># Date 1426196575 25200
> >#      Thu Mar 12 14:42:55 2015 -0700
> ># Node ID 2fdd632353a2381e88ed2572a4e691502adc5992
> ># Parent  0c3a80879d4ede76101bbe46d4a67a19a6e28608
> >record: add tests for the curses recording interface
> >
> >diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t
> >new file mode 100644
> >--- /dev/null
> >+++ b/tests/test-commit-interactive-curses.t
> >@@ -0,0 +1,183 @@
> >+Set up a repo
> >+
> >+  $ cat <<EOF >> $HGRCPATH
> >+  > [ui]
> >+  > interactive = true
> >+  > [experimental]
> >+  > crecord = true
> >+  > crecordTestMode = testModeCommands
> >+  > EOF
> >+
> >+  $ hg init a
> >+  $ cd a
> >+
> >+Comiting some changes but stopping on the way
>
> Commiting ;-) (fixed locally)

Committing, actually.

>
> --
> Pierre-Yves David
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t
new file mode 100644
--- /dev/null
+++ b/tests/test-commit-interactive-curses.t
@@ -0,0 +1,183 @@ 
+Set up a repo
+
+  $ cat <<EOF >> $HGRCPATH
+  > [ui]
+  > interactive = true
+  > [experimental]
+  > crecord = true
+  > crecordTestMode = testModeCommands
+  > EOF
+
+  $ hg init a
+  $ cd a
+
+Comiting some changes but stopping on the way
+
+  $ echo "a" > a
+  $ hg add a
+  $ cat <<EOF >testModeCommands
+  > TOGGLE
+  > X
+  > EOF
+  $ hg commit -i  -m "a" -d "0 0"
+  no changes to record
+  $ hg tip
+  changeset:   -1:000000000000
+  tag:         tip
+  user:        
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  
+
+Comiting some changes
+
+  $ cat <<EOF >testModeCommands
+  > X
+  > EOF
+  $ hg commit -i  -m "a" -d "0 0"
+  $ hg tip
+  changeset:   0:cb9a9f314b8b
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
+Commiting only one file
+
+  $ echo "a" >> a
+  $ seq 1 10 > b
+  $ hg add b
+  $ cat <<EOF >testModeCommands
+  > TOGGLE
+  > KEY_DOWN
+  > X
+  > EOF
+  $ hg commit -i  -m "one file" -d "0 0"
+  $ hg tip
+  changeset:   1:fb2705a663ea
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     one file
+  
+  $ hg cat -r tip a
+  a
+  $ cat a
+  a
+  a
+
+Commiting only one hunk
+- Untoggle all the hunks, go down to the second file
+- unfold it
+- go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
+- toggle the second hunk
+- commit
+
+  $ echo "x" > c
+  $ cat b >> c
+  $ echo "y" >> c
+  $ mv c b
+  $ cat <<EOF >testModeCommands
+  > A
+  > KEY_DOWN
+  > f
+  > KEY_DOWN
+  > KEY_DOWN
+  > KEY_DOWN
+  > KEY_DOWN
+  > TOGGLE
+  > X
+  > EOF
+  $ hg commit -i  -m "one hunk" -d "0 0"
+  $ hg tip
+  changeset:   2:7d10dfe755a8
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     one hunk
+  
+  $ hg cat -r tip b
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10
+  y
+  $ cat b
+  x
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10
+  y
+  $ hg commit -m "other hunks"
+  $ hg tip
+  changeset:   3:a6735021574d
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     other hunks
+  
+  $ hg cat -r tip b
+  x
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10
+  y
+
+Editing patch of newly added file
+
+  $ cat > editor.sh << '__EOF__'
+  > cat "$1"  | sed "s/first/very/g"  > tt
+  > mv tt  "$1"
+  > __EOF__
+  $ cat > newfile << '__EOF__'
+  > This is the first line
+  > This is the second line
+  > This is the third line
+  > __EOF__
+  $ hg add newfile
+  $ cat <<EOF >testModeCommands
+  > f
+  > KEY_DOWN
+  > KEY_DOWN
+  > KEY_DOWN
+  > e
+  > X
+  > EOF
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-new
+  $ hg tip
+  changeset:   4:6a0a43e9eff5
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:23 1970 +0000
+  summary:     edit-patch-new
+  
+  $ hg cat -r tip newfile
+  This is the very line
+  This is the second line
+  This is the third line
+
+  $ cat newfile
+  This is the first line
+  This is the second line
+  This is the third line
+
+