tests/test-split.t
changeset 42855 1fd530b1e1cf
parent 42566 f802a75da585
child 42856 3cf091843b4f
equal deleted inserted replaced
42854:db51a4ac85ac 42855:1fd530b1e1cf
   787 
   787 
   788   $ printf 'y\ny\ny\n' | hg split
   788   $ printf 'y\ny\ny\n' | hg split
   789   abort: cannot split an empty revision
   789   abort: cannot split an empty revision
   790   [255]
   790   [255]
   791 #endif
   791 #endif
       
   792 
       
   793 Test that splitting copies works properly (issue5723)
       
   794 ----------------------------------------------------
       
   795 
       
   796   $ hg init $TESTTMP/issue5723-cp
       
   797   $ cd $TESTTMP/issue5723-cp
       
   798   $ printf '1\n2\n' > file
       
   799   $ hg ci -qAm initial
       
   800   $ hg cp file file2
       
   801   $ printf 'a\nb\n1\n2\n3\n4\n' > file2
       
   802 Also modify 'file' to prove that the changes aren't being pulled in
       
   803 accidentally.
       
   804   $ printf 'this is the new contents of "file"' > file
       
   805   $ cat > $TESTTMP/messages <<EOF
       
   806   > split1, keeping "file" and only the numbered lines in file2
       
   807   > --
       
   808   > split2, keeping the lettered lines in file2
       
   809   > EOF
       
   810   $ hg ci -m 'copy file->file2, modify both'
       
   811   $ printf 'f\ny\nn\na\na\n' | hg split
       
   812   diff --git a/file b/file
       
   813   1 hunks, 2 lines changed
       
   814   examine changes to 'file'?
       
   815   (enter ? for help) [Ynesfdaq?] f
       
   816   
       
   817   diff --git a/file b/file2
       
   818   copy from file
       
   819   copy to file2
       
   820   2 hunks, 4 lines changed
       
   821   examine changes to 'file' and 'file2'?
       
   822   (enter ? for help) [Ynesfdaq?] y
       
   823   
       
   824   @@ -0,0 +1,2 @@
       
   825   +a
       
   826   +b
       
   827   record change 2/3 to 'file2'?
       
   828   (enter ? for help) [Ynesfdaq?] n
       
   829   
       
   830   @@ -2,0 +5,2 @@ 2
       
   831   +3
       
   832   +4
       
   833   record change 3/3 to 'file2'?
       
   834   (enter ? for help) [Ynesfdaq?] a
       
   835   
       
   836   EDITOR: HG: Splitting 41c861dfa61e. Write commit message for the first split changeset.
       
   837   EDITOR: copy file->file2, modify both
       
   838   EDITOR: 
       
   839   EDITOR: 
       
   840   EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
   841   EDITOR: HG: Leave message empty to abort commit.
       
   842   EDITOR: HG: --
       
   843   EDITOR: HG: user: test
       
   844   EDITOR: HG: branch 'default'
       
   845   EDITOR: HG: added file2
       
   846   EDITOR: HG: changed file
       
   847   created new head
       
   848   diff --git a/file2 b/file2
       
   849   1 hunks, 2 lines changed
       
   850   examine changes to 'file2'?
       
   851   (enter ? for help) [Ynesfdaq?] a
       
   852   
       
   853   EDITOR: HG: Splitting 41c861dfa61e. So far it has been split into:
       
   854   EDITOR: HG: - 4b19e06610eb: split1, keeping "file" and only the numbered lines in file2
       
   855   EDITOR: HG: Write commit message for the next split changeset.
       
   856   EDITOR: copy file->file2, modify both
       
   857   EDITOR: 
       
   858   EDITOR: 
       
   859   EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
   860   EDITOR: HG: Leave message empty to abort commit.
       
   861   EDITOR: HG: --
       
   862   EDITOR: HG: user: test
       
   863   EDITOR: HG: branch 'default'
       
   864   EDITOR: HG: changed file2
       
   865   saved backup bundle to $TESTTMP/issue5723-cp/.hg/strip-backup/41c861dfa61e-467e8d3c-split.hg (obsstore-off !)
       
   866   $ hg log -T '{desc}: {files%"{file} "}\n'
       
   867   split2, keeping the lettered lines in file2: file2 
       
   868   split1, keeping "file" and only the numbered lines in file2: file file2 
       
   869   initial: file 
       
   870   $ cat file2
       
   871   a
       
   872   b
       
   873   1
       
   874   2
       
   875   3
       
   876   4
       
   877   $ hg cat -r ".^" file2
       
   878   1
       
   879   2
       
   880   3
       
   881   4
       
   882   $ hg cat -r . file2
       
   883   a
       
   884   b
       
   885   1
       
   886   2
       
   887   3
       
   888   4