Show More
@@ -217,7 +217,7 b' def clean(repo, node, wlock=None, show_s' | |||
|
217 | 217 | |
|
218 | 218 | def merge(repo, node, force=None, remind=True, wlock=None): |
|
219 | 219 | """branch merge with node, resolving changes""" |
|
220 |
return _merge.update(repo, node, branchmerge=True, force |
|
|
220 | return _merge.update(repo, node, branchmerge=True, force=force, | |
|
221 | 221 | remind=remind, wlock=wlock) |
|
222 | 222 | |
|
223 | 223 | def revert(repo, node, choose, wlock): |
@@ -48,7 +48,10 b' def merge3(repo, fn, my, other, p1, p2):' | |||
|
48 | 48 | return r |
|
49 | 49 | |
|
50 | 50 | def update(repo, node, branchmerge=False, force=False, partial=None, |
|
51 |
|
|
|
51 | wlock=None, show_stats=True, remind=True): | |
|
52 | ||
|
53 | overwrite = force and not branchmerge | |
|
54 | forcemerge = force and branchmerge | |
|
52 | 55 | |
|
53 | 56 | if not wlock: |
|
54 | 57 | wlock = repo.wlock() |
@@ -56,7 +59,7 b' def update(repo, node, branchmerge=False' | |||
|
56 | 59 | ### check phase |
|
57 | 60 | |
|
58 | 61 | pl = repo.dirstate.parents() |
|
59 |
if not |
|
|
62 | if not overwrite and pl[1] != nullid: | |
|
60 | 63 | raise util.Abort(_("outstanding uncommitted merges")) |
|
61 | 64 | |
|
62 | 65 | p1, p2 = pl[0], node |
@@ -68,8 +71,8 b' def update(repo, node, branchmerge=False' | |||
|
68 | 71 | raise util.Abort(_("there is nothing to merge, just use " |
|
69 | 72 | "'hg update' or look at 'hg heads'")) |
|
70 | 73 | |
|
71 |
if not |
|
|
72 |
raise util.Abort(_(" |
|
|
74 | if not overwrite and not linear_path and not branchmerge: | |
|
75 | raise util.Abort(_("update spans branches, use 'hg merge' " | |
|
73 | 76 | "or 'hg update -C' to lose changes")) |
|
74 | 77 | |
|
75 | 78 | modified, added, removed, deleted, unknown = repo.changes() |
@@ -87,7 +90,7 b' def update(repo, node, branchmerge=False' | |||
|
87 | 90 | ma = repo.manifest.read(man) |
|
88 | 91 | mfa = repo.manifest.readflags(man) |
|
89 | 92 | |
|
90 |
if not forcemerge and not |
|
|
93 | if not forcemerge and not overwrite: | |
|
91 | 94 | for f in unknown: |
|
92 | 95 | if f in m2: |
|
93 | 96 | t1 = repo.wread(f) |
@@ -99,8 +102,8 b' def update(repo, node, branchmerge=False' | |||
|
99 | 102 | # resolve the manifest to determine which files |
|
100 | 103 | # we care about merging |
|
101 | 104 | repo.ui.note(_("resolving manifests\n")) |
|
102 |
repo.ui.debug(_(" |
|
|
103 |
( |
|
|
105 | repo.ui.debug(_(" overwrite %s branchmerge %s partial %s linear %s\n") % | |
|
106 | (overwrite, branchmerge, partial and True or False, linear_path)) | |
|
104 | 107 | repo.ui.debug(_(" ancestor %s local %s remote %s\n") % |
|
105 | 108 | (short(man), short(m1n), short(m2n))) |
|
106 | 109 | |
@@ -159,7 +162,7 b' def update(repo, node, branchmerge=False' | |||
|
159 | 162 | # are we clobbering? |
|
160 | 163 | # is remote's version newer? |
|
161 | 164 | # or are we going back in time? |
|
162 |
elif |
|
|
165 | elif overwrite or m2[f] != a or (p2 == pa and mw[f] == m1[f]): | |
|
163 | 166 | repo.ui.debug(_(" remote %s is newer, get\n") % f) |
|
164 | 167 | get[f] = m2[f] |
|
165 | 168 | s = 1 |
@@ -169,7 +172,7 b' def update(repo, node, branchmerge=False' | |||
|
169 | 172 | get[f] = m2[f] |
|
170 | 173 | |
|
171 | 174 | if not s and mfw[f] != mf2[f]: |
|
172 |
if |
|
|
175 | if overwrite: | |
|
173 | 176 | repo.ui.debug(_(" updating permissions for %s\n") % f) |
|
174 | 177 | util.set_exec(repo.wjoin(f), mf2[f]) |
|
175 | 178 | else: |
@@ -183,7 +186,7 b' def update(repo, node, branchmerge=False' | |||
|
183 | 186 | elif f in ma: |
|
184 | 187 | if n != ma[f]: |
|
185 | 188 | r = _("d") |
|
186 |
if not |
|
|
189 | if not overwrite and (linear_path or branchmerge): | |
|
187 | 190 | r = repo.ui.prompt( |
|
188 | 191 | (_(" local changed %s which remote deleted\n") % f) + |
|
189 | 192 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) |
@@ -194,7 +197,7 b' def update(repo, node, branchmerge=False' | |||
|
194 | 197 | remove.append(f) # other deleted it |
|
195 | 198 | else: |
|
196 | 199 | # file is created on branch or in working directory |
|
197 |
if |
|
|
200 | if overwrite and f not in umap: | |
|
198 | 201 | repo.ui.debug(_("remote deleted %s, clobbering\n") % f) |
|
199 | 202 | remove.append(f) |
|
200 | 203 | elif n == m1.get(f, nullid): # same as parent |
@@ -213,7 +216,7 b' def update(repo, node, branchmerge=False' | |||
|
213 | 216 | continue |
|
214 | 217 | if f in ma and n != ma[f]: |
|
215 | 218 | r = _("k") |
|
216 |
if not |
|
|
219 | if not overwrite and (linear_path or branchmerge): | |
|
217 | 220 | r = repo.ui.prompt( |
|
218 | 221 | (_("remote changed %s which local deleted\n") % f) + |
|
219 | 222 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) |
@@ -223,7 +226,7 b' def update(repo, node, branchmerge=False' | |||
|
223 | 226 | repo.ui.debug(_("remote created %s\n") % f) |
|
224 | 227 | get[f] = n |
|
225 | 228 | else: |
|
226 |
if |
|
|
229 | if overwrite or p2 == pa: # going backwards? | |
|
227 | 230 | repo.ui.debug(_("local deleted %s, recreating\n") % f) |
|
228 | 231 | get[f] = n |
|
229 | 232 | else: |
@@ -231,12 +234,12 b' def update(repo, node, branchmerge=False' | |||
|
231 | 234 | |
|
232 | 235 | del mw, m1, m2, ma |
|
233 | 236 | |
|
234 |
if |
|
|
237 | if overwrite: | |
|
235 | 238 | for f in merge: |
|
236 | 239 | get[f] = merge[f][1] |
|
237 | 240 | merge = {} |
|
238 | 241 | |
|
239 |
if linear_path or |
|
|
242 | if linear_path or overwrite: | |
|
240 | 243 | # we don't need to do any magic, just jump to the new rev |
|
241 | 244 | p1, p2 = p2, nullid |
|
242 | 245 |
General Comments 0
You need to be logged in to leave comments.
Login now