[PATCH 4 of 4] branch closing: add test for branch closing (and reopening)

John Mulligan phlogistonjohn at asynchrono.us
Thu Dec 11 14:10:09 CST 2008


# HG changeset patch
# User John Mulligan <phlogistonjohn at asynchrono.us>
# Date 1228956314 18000
# Node ID 49689194e2dcbbf00b906151b40a2c24fbcb8e2c
# Parent  60bebc4475e3e1c3e51d286c226cb0d574a3b89c
branch closing: add test for branch closing (and reopening)

diff --git a/tests/test-branches b/tests/test-branches
--- a/tests/test-branches
+++ b/tests/test-branches
@@ -50,3 +50,37 @@
 
 echo "---- Branch b"
 hg log -b b
+
+echo "---- going to test branch closing"
+hg heads
+hg branches
+hg co -C b
+hg parents
+echo "---- closing branch b"
+hg commit -d '7 0' -u test --close-branch -m "zap b branch"
+hg branches
+hg heads
+hg parents
+echo "---- reopen branch b"
+hg co -C 7db20c52f570
+echo 'reopen' >bh1
+hg commit -d '8 0' -u test -m "reopen b branch"
+hg branches
+echo '---- multi-headed branch'
+echo 'xxx' >> bh1
+hg commit -d '9 0' -u test -m 'add one head to b'
+hg co -C 9
+echo 'yyy' >> bh1
+hg commit -d '9 0' -u test -m 'add another head to b'
+echo 'zzz' >> bh1
+hg commit -d '10 0' -u test -m 'this will be tipmost on b'
+hg branches
+hg commit -d '11 0' -u test --close-branch -m 'close b again'
+echo '-- branch b should still be there'
+hg branches
+hg co -C 10
+hg commit -d '12 0' -u test --close-branch -m 'close b other head'
+echo '---- hg does not know branch b'
+hg branches
+hg up -C b
+hg up -C a
diff --git a/tests/test-branches.out b/tests/test-branches.out
--- a/tests/test-branches.out
+++ b/tests/test-branches.out
@@ -49,3 +49,77 @@
 date:        Thu Jan 01 00:00:02 1970 +0000
 summary:     Adding b branch
 
+---- going to test branch closing
+changeset:   7:10ff5895aa57
+branch:      a branch name much longer than the default justification used by branches
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:06 1970 +0000
+summary:     Adding d branch
+
+changeset:   4:aee39cd168d0
+branch:      b
+user:        test
+date:        Thu Jan 01 00:00:03 1970 +0000
+summary:     Adding b branch head 1
+
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
+b                              4:aee39cd168d0
+c                              6:589736a22561 (inactive)
+a                              5:d8cbc61dbaa6 (inactive)
+default                        0:19709c5a4e75 (inactive)
+2 files updated, 0 files merged, 4 files removed, 0 files unresolved
+changeset:   4:aee39cd168d0
+branch:      b
+user:        test
+date:        Thu Jan 01 00:00:03 1970 +0000
+summary:     Adding b branch head 1
+
+---- closing branch b
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
+c                              6:589736a22561 (inactive)
+a                              5:d8cbc61dbaa6 (inactive)
+default                        0:19709c5a4e75 (inactive)
+changeset:   7:10ff5895aa57
+branch:      a branch name much longer than the default justification used by branches
+user:        test
+date:        Thu Jan 01 00:00:06 1970 +0000
+summary:     Adding d branch
+
+changeset:   8:7db20c52f570
+branch:      b
+tag:         tip
+parent:      4:aee39cd168d0
+user:        test
+date:        Thu Jan 01 00:00:07 1970 +0000
+summary:     zap b branch
+
+---- reopen branch b
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+b                              9:52b756139966
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
+c                              6:589736a22561 (inactive)
+a                              5:d8cbc61dbaa6 (inactive)
+default                        0:19709c5a4e75 (inactive)
+---- multi-headed branch
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+created new head
+b                             12:72da7e5ea8dd
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
+c                              6:589736a22561 (inactive)
+a                              5:d8cbc61dbaa6 (inactive)
+default                        0:19709c5a4e75 (inactive)
+-- branch b should still be there
+b                             10:b8982783f449
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
+c                              6:589736a22561 (inactive)
+a                              5:d8cbc61dbaa6 (inactive)
+default                        0:19709c5a4e75 (inactive)
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+---- hg does not know branch b
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
+c                              6:589736a22561 (inactive)
+a                              5:d8cbc61dbaa6 (inactive)
+default                        0:19709c5a4e75 (inactive)
+abort: 00changelog.i at b: ambiguous identifier!
+2 files updated, 0 files merged, 2 files removed, 0 files unresolved
diff --git a/tests/test-record.out b/tests/test-record.out
--- a/tests/test-record.out
+++ b/tests/test-record.out
@@ -27,13 +27,14 @@
 
 options:
 
- -A --addremove  mark new/missing files as added/removed before committing
- -I --include    include names matching the given patterns
- -X --exclude    exclude names matching the given patterns
- -m --message    use <text> as commit message
- -l --logfile    read commit message from <file>
- -d --date       record datecode as commit date
- -u --user       record user as committer
+ -A --addremove     mark new/missing files as added/removed before committing
+    --close-branch  mark a branch as closed, hiding it from the branch list
+ -I --include       include names matching the given patterns
+ -X --exclude       exclude names matching the given patterns
+ -m --message       use <text> as commit message
+ -l --logfile       read commit message from <file>
+ -d --date          record datecode as commit date
+ -u --user          record user as committer
 
 use "hg -v help record" to show global options
 % select no files


More information about the Mercurial-devel mailing list