Show More
@@ -53,12 +53,30 b' def update(repo, node, branchmerge=False' | |||||
53 | if not wlock: |
|
53 | if not wlock: | |
54 | wlock = repo.wlock() |
|
54 | wlock = repo.wlock() | |
55 |
|
55 | |||
|
56 | ### check phase | |||
|
57 | ||||
56 | pl = repo.dirstate.parents() |
|
58 | pl = repo.dirstate.parents() | |
57 | if not force and pl[1] != nullid: |
|
59 | if not force and pl[1] != nullid: | |
58 | raise util.Abort(_("outstanding uncommitted merges")) |
|
60 | raise util.Abort(_("outstanding uncommitted merges")) | |
59 |
|
61 | |||
60 | p1, p2 = pl[0], node |
|
62 | p1, p2 = pl[0], node | |
61 | pa = repo.changelog.ancestor(p1, p2) |
|
63 | pa = repo.changelog.ancestor(p1, p2) | |
|
64 | ||||
|
65 | # is there a linear path from p1 to p2? | |||
|
66 | linear_path = (pa == p1 or pa == p2) | |||
|
67 | if branchmerge and linear_path: | |||
|
68 | raise util.Abort(_("there is nothing to merge, just use " | |||
|
69 | "'hg update' or look at 'hg heads'")) | |||
|
70 | ||||
|
71 | if not force and not linear_path and not branchmerge: | |||
|
72 | raise util.Abort(_("this update spans a branch, use 'hg merge' " | |||
|
73 | "or 'hg update -C' to lose changes")) | |||
|
74 | ||||
|
75 | modified, added, removed, deleted, unknown = repo.changes() | |||
|
76 | if branchmerge and not forcemerge: | |||
|
77 | if modified or added or removed: | |||
|
78 | raise util.Abort(_("outstanding uncommitted changes")) | |||
|
79 | ||||
62 | m1n = repo.changelog.read(p1)[0] |
|
80 | m1n = repo.changelog.read(p1)[0] | |
63 | m2n = repo.changelog.read(p2)[0] |
|
81 | m2n = repo.changelog.read(p2)[0] | |
64 | man = repo.manifest.ancestor(m1n, m2n) |
|
82 | man = repo.manifest.ancestor(m1n, m2n) | |
@@ -69,19 +87,6 b' def update(repo, node, branchmerge=False' | |||||
69 | ma = repo.manifest.read(man) |
|
87 | ma = repo.manifest.read(man) | |
70 | mfa = repo.manifest.readflags(man) |
|
88 | mfa = repo.manifest.readflags(man) | |
71 |
|
89 | |||
72 | modified, added, removed, deleted, unknown = repo.changes() |
|
|||
73 |
|
||||
74 | # is this a jump, or a merge? i.e. is there a linear path |
|
|||
75 | # from p1 to p2? |
|
|||
76 | linear_path = (pa == p1 or pa == p2) |
|
|||
77 |
|
||||
78 | if branchmerge and linear_path: |
|
|||
79 | raise util.Abort(_("there is nothing to merge, just use " |
|
|||
80 | "'hg update' or look at 'hg heads'")) |
|
|||
81 | if branchmerge and not forcemerge: |
|
|||
82 | if modified or added or removed: |
|
|||
83 | raise util.Abort(_("outstanding uncommitted changes")) |
|
|||
84 |
|
||||
85 | if not forcemerge and not force: |
|
90 | if not forcemerge and not force: | |
86 | for f in unknown: |
|
91 | for f in unknown: | |
87 | if f in m2: |
|
92 | if f in m2: | |
@@ -234,21 +239,6 b' def update(repo, node, branchmerge=False' | |||||
234 | if linear_path or force: |
|
239 | if linear_path or force: | |
235 | # we don't need to do any magic, just jump to the new rev |
|
240 | # we don't need to do any magic, just jump to the new rev | |
236 | p1, p2 = p2, nullid |
|
241 | p1, p2 = p2, nullid | |
237 | else: |
|
|||
238 | if not branchmerge: |
|
|||
239 | repo.ui.status(_("this update spans a branch" |
|
|||
240 | " affecting the following files:\n")) |
|
|||
241 | fl = merge.keys() + get.keys() |
|
|||
242 | fl.sort() |
|
|||
243 | for f in fl: |
|
|||
244 | cf = "" |
|
|||
245 | if f in merge: |
|
|||
246 | cf = _(" (resolve)") |
|
|||
247 | repo.ui.status(" %s%s\n" % (f, cf)) |
|
|||
248 | repo.ui.warn(_("aborting update spanning branches!\n")) |
|
|||
249 | repo.ui.status(_("(use 'hg merge' to merge across branches" |
|
|||
250 | " or 'hg update -C' to lose changes)\n")) |
|
|||
251 | return 1 |
|
|||
252 |
|
242 | |||
253 | xp1 = hex(p1) |
|
243 | xp1 = hex(p1) | |
254 | xp2 = hex(p2) |
|
244 | xp2 = hex(p2) |
General Comments 0
You need to be logged in to leave comments.
Login now