Patchwork [1,of,2] tests: improve test coverage of branch command and existing branches

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 29, 2014, 10:22 a.m.
Message ID <104cfce5efd2e557801d.1409307764@localhost.localdomain>
Download mbox | patch
Permalink /patch/5622/
State Accepted
Commit 9510b0e9480b816983dd0faedfb955bb1160b483
Headers show

Comments

Mads Kiilerich - Aug. 29, 2014, 10:22 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1409307473 -7200
#      Fri Aug 29 12:17:53 2014 +0200
# Node ID 104cfce5efd2e557801dd45dba6e35b056b8f3d2
# Parent  926bc0d3b595caf37c5d70833a347eb43285de2f
tests: improve test coverage of branch command and existing branches
Pierre-Yves David - Aug. 29, 2014, 4:07 p.m.
On 08/29/2014 12:22 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1409307473 -7200
> #      Fri Aug 29 12:17:53 2014 +0200
> # Node ID 104cfce5efd2e557801dd45dba6e35b056b8f3d2
> # Parent  926bc0d3b595caf37c5d70833a347eb43285de2f
> tests: improve test coverage of branch command and existing branches

Patch 1: pushed to the clowncopter

Patch

diff --git a/tests/test-newbranch.t b/tests/test-newbranch.t
--- a/tests/test-newbranch.t
+++ b/tests/test-newbranch.t
@@ -51,11 +51,28 @@  There should be only one default branch 
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     clear branch name
   
+Merging and branches
 
   $ hg co foo
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch
   foo
+
+ set existing branch name fails unless force - setting existing parent branch works without force:
+
+  $ hg branch bar
+  abort: a branch of the same name already exists
+  (use 'hg update' to switch to it)
+  [255]
+
+  $ hg branch -f bar
+  marked working directory as branch bar
+  (branches are permanent and global, did you want a bookmark?)
+
+  $ hg branch foo
+  marked working directory as branch foo
+  (branches are permanent and global, did you want a bookmark?)
+
   $ echo bleah > a
   $ hg ci -m "modify a branch"
 
@@ -65,46 +82,40 @@  There should be only one default branch 
 
   $ hg branch
   foo
+
+ set existing branch name where branch head is ancestor:
+
+  $ hg branch bar
+  abort: a branch of the same name already exists
+  (use 'hg update' to switch to it)
+  [255]
+
+ set (other) parent branch as branch name
+
+  $ hg branch default
+  marked working directory as branch default
+  (branches are permanent and global, did you want a bookmark?)
+
+ set (first) parent branch as branch name
+
+  $ hg branch foo
+  marked working directory as branch foo
+  (branches are permanent and global, did you want a bookmark?)
+
   $ hg ci -m "merge"
 
-  $ hg log
-  changeset:   5:530046499edf
-  branch:      foo
-  tag:         tip
-  parent:      4:adf1a74a7f7b
-  parent:      3:1c28f494dae6
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     merge
-  
-  changeset:   4:adf1a74a7f7b
-  branch:      foo
-  parent:      1:6c0e42da283a
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     modify a branch
-  
-  changeset:   3:1c28f494dae6
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     clear branch name
-  
-  changeset:   2:c21617b13b22
-  branch:      bar
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     change branch name
-  
-  changeset:   1:6c0e42da283a
-  branch:      foo
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     add branch name
-  
-  changeset:   0:db01e8ea3388
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     initial
+  $ hg log -G -T '{rev}:{node|short} {branch} {desc}\n'
+  @    5:530046499edf foo merge
+  |\
+  | o  4:adf1a74a7f7b foo modify a branch
+  | |
+  o |  3:1c28f494dae6 default clear branch name
+  | |
+  o |  2:c21617b13b22 bar change branch name
+  |/
+  o  1:6c0e42da283a foo add branch name
+  |
+  o  0:db01e8ea3388 default initial
   
   $ hg branches
   foo                            5:530046499edf