Show More
@@ -0,0 +1,51 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | hgcommit() { | |||
|
4 | hg commit -u user -d '0 0' "$@" | |||
|
5 | } | |||
|
6 | ||||
|
7 | hg init clhead | |||
|
8 | cd clhead | |||
|
9 | ||||
|
10 | ||||
|
11 | touch foo && hg add && hgcommit -m 'foo' | |||
|
12 | touch bar && hg add && hgcommit -m 'bar' | |||
|
13 | touch baz && hg add && hgcommit -m 'baz' | |||
|
14 | ||||
|
15 | echo "flub" > foo | |||
|
16 | hgcommit -m "flub" | |||
|
17 | echo "nub" > foo | |||
|
18 | hgcommit -m "nub" | |||
|
19 | ||||
|
20 | hg up -C 2 | |||
|
21 | ||||
|
22 | echo "c1" > c1 | |||
|
23 | hg add c1 | |||
|
24 | hgcommit -m "c1" | |||
|
25 | echo "c2" > c1 | |||
|
26 | hgcommit -m "c2" | |||
|
27 | ||||
|
28 | hg up -C 2 | |||
|
29 | ||||
|
30 | echo "d1" > d1 | |||
|
31 | hg add d1 | |||
|
32 | hgcommit -m "d1" | |||
|
33 | echo "d2" > d1 | |||
|
34 | hgcommit -m "d2" | |||
|
35 | hg tag -l good | |||
|
36 | ||||
|
37 | echo '% fail with three heads' | |||
|
38 | hg up -C good | |||
|
39 | hg merge | |||
|
40 | ||||
|
41 | echo '% close one of the heads' | |||
|
42 | hg up -C 6 | |||
|
43 | hgcommit -m 'close this head' --close-branch | |||
|
44 | ||||
|
45 | echo '% succeed with two open heads' | |||
|
46 | hg up -C good | |||
|
47 | hg up -C good | |||
|
48 | hg merge | |||
|
49 | hgcommit -m 'merged heads' | |||
|
50 | ||||
|
51 |
@@ -0,0 +1,17 b'' | |||||
|
1 | adding foo | |||
|
2 | adding bar | |||
|
3 | adding baz | |||
|
4 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
5 | created new head | |||
|
6 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
7 | created new head | |||
|
8 | % fail with three heads | |||
|
9 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
10 | abort: branch 'default' has 3 heads - please merge with an explicit rev | |||
|
11 | % close one of the heads | |||
|
12 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
13 | % succeed with two open heads | |||
|
14 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
15 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
17 | (branch merge, don't forget to commit) |
@@ -1113,7 +1113,7 b' class localrepository(repo.repository):' | |||||
1113 | finally: |
|
1113 | finally: | |
1114 | wlock.release() |
|
1114 | wlock.release() | |
1115 |
|
1115 | |||
1116 |
def heads(self, start=None, closed= |
|
1116 | def heads(self, start=None, closed=False): | |
1117 | heads = self.changelog.heads(start) |
|
1117 | heads = self.changelog.heads(start) | |
1118 | def display(head): |
|
1118 | def display(head): | |
1119 | if closed: |
|
1119 | if closed: | |
@@ -1124,7 +1124,7 b' class localrepository(repo.repository):' | |||||
1124 | heads = [(-self.changelog.rev(h), h) for h in heads if display(h)] |
|
1124 | heads = [(-self.changelog.rev(h), h) for h in heads if display(h)] | |
1125 | return [n for (r, n) in sorted(heads)] |
|
1125 | return [n for (r, n) in sorted(heads)] | |
1126 |
|
1126 | |||
1127 |
def branchheads(self, branch=None, start=None, closed= |
|
1127 | def branchheads(self, branch=None, start=None, closed=False): | |
1128 | if branch is None: |
|
1128 | if branch is None: | |
1129 | branch = self[None].branch() |
|
1129 | branch = self[None].branch() | |
1130 | branches = self.branchmap() |
|
1130 | branches = self.branchmap() |
General Comments 0
You need to be logged in to leave comments.
Login now