##// END OF EJS Templates
merge: add hints about the use of 'hg heads' to find the rev to merge
Benoit Boissinot -
r10355:a5576908 default
parent child Browse files
Show More
@@ -2136,16 +2136,19 b' def merge(ui, repo, node=None, **opts):'
2136 branch = repo.changectx(None).branch()
2136 branch = repo.changectx(None).branch()
2137 bheads = repo.branchheads(branch)
2137 bheads = repo.branchheads(branch)
2138 if len(bheads) > 2:
2138 if len(bheads) > 2:
2139 raise util.Abort(_("branch '%s' has %d heads - "
2139 ui.warn(_("abort: branch '%s' has %d heads - "
2140 "please merge with an explicit rev") %
2140 "please merge with an explicit rev\n")
2141 (branch, len(bheads)))
2141 % (branch, len(bheads)))
2142 ui.status(_("(run 'hg heads .' to see heads)\n"))
2143 return False
2142
2144
2143 parent = repo.dirstate.parents()[0]
2145 parent = repo.dirstate.parents()[0]
2144 if len(bheads) == 1:
2146 if len(bheads) == 1:
2145 if len(repo.heads()) > 1:
2147 if len(repo.heads()) > 1:
2146 raise util.Abort(_("branch '%s' has one head - "
2148 ui.warn(_("abort: branch '%s' has one head - "
2147 "please merge with an explicit rev") %
2149 "please merge with an explicit rev\n" % branch))
2148 branch)
2150 ui.status(_("(run 'hg heads' to see all heads)\n"))
2151 return False
2149 msg = _('there is nothing to merge')
2152 msg = _('there is nothing to merge')
2150 if parent != repo.lookup(repo[None].branch()):
2153 if parent != repo.lookup(repo[None].branch()):
2151 msg = _('%s - use "hg update" instead') % msg
2154 msg = _('%s - use "hg update" instead') % msg
@@ -8,6 +8,7 b' created new head'
8 % fail with three heads
8 % fail with three heads
9 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
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
10 abort: branch 'default' has 3 heads - please merge with an explicit rev
11 (run 'hg heads .' to see heads)
11 % close one of the heads
12 % close one of the heads
12 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 % succeed with two open heads
14 % succeed with two open heads
@@ -42,4 +42,11 b' hg up 0'
42 echo % should fail because 1 head
42 echo % should fail because 1 head
43 hg merge
43 hg merge
44
44
45 hg up 3
46 echo a >> a
47 hg branch foobranch
48 hg commit -mf
49 echo % should fail because merge with other branch
50 hg merge
51
45 true
52 true
@@ -6,9 +6,11 b' created new head'
6 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
6 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
7 % should fail because not at a head
7 % should fail because not at a head
8 abort: branch 'default' has 3 heads - please merge with an explicit rev
8 abort: branch 'default' has 3 heads - please merge with an explicit rev
9 (run 'hg heads .' to see heads)
9 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 % should fail because > 2 heads
11 % should fail because > 2 heads
11 abort: branch 'default' has 3 heads - please merge with an explicit rev
12 abort: branch 'default' has 3 heads - please merge with an explicit rev
13 (run 'hg heads .' to see heads)
12 % should succeed
14 % should succeed
13 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
15 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 (branch merge, don't forget to commit)
16 (branch merge, don't forget to commit)
@@ -26,3 +28,9 b' abort: there is nothing to merge'
26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 % should fail because 1 head
29 % should fail because 1 head
28 abort: there is nothing to merge - use "hg update" instead
30 abort: there is nothing to merge - use "hg update" instead
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 marked working directory as branch foobranch
33 created new head
34 % should fail because merge with other branch
35 abort: branch 'foobranch' has one head - please merge with an explicit rev
36 (run 'hg heads' to see all heads)
@@ -168,9 +168,11 b' summary: a'
168
168
169 % implicit merge with test branch as parent
169 % implicit merge with test branch as parent
170 abort: branch 'test' has one head - please merge with an explicit rev
170 abort: branch 'test' has one head - please merge with an explicit rev
171 (run 'hg heads' to see all heads)
171 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
172 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
172 % implicit merge with default branch as parent
173 % implicit merge with default branch as parent
173 abort: branch 'default' has 3 heads - please merge with an explicit rev
174 abort: branch 'default' has 3 heads - please merge with an explicit rev
175 (run 'hg heads .' to see heads)
174 % 3 branch heads, explicit merge required
176 % 3 branch heads, explicit merge required
175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 (branch merge, don't forget to commit)
178 (branch merge, don't forget to commit)
General Comments 0
You need to be logged in to leave comments. Login now