Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 3110:40e777bda455
merge: remove linear variable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 17 Sep 2006 17:13:02 -0500 |
parents | 62044d161470 |
children | 5cc62d99b785 |
comparison
equal
deleted
inserted
replaced
3109:62044d161470 | 3110:40e777bda455 |
---|---|
219 | 219 |
220 # are we going backwards? | 220 # are we going backwards? |
221 backwards = (pa == p2) | 221 backwards = (pa == p2) |
222 | 222 |
223 # is there a linear path from p1 to p2? | 223 # is there a linear path from p1 to p2? |
224 linear = (pa == p1 or pa == p2) | 224 if pa == p1 or pa == p2: |
225 if branchmerge and linear: | 225 if branchmerge: |
226 raise util.Abort(_("there is nothing to merge, just use " | 226 raise util.Abort(_("there is nothing to merge, just use " |
227 "'hg update' or look at 'hg heads'")) | 227 "'hg update' or look at 'hg heads'")) |
228 | 228 elif not (overwrite or branchmerge): |
229 if not linear and not (overwrite or branchmerge): | |
230 raise util.Abort(_("update spans branches, use 'hg merge' " | 229 raise util.Abort(_("update spans branches, use 'hg merge' " |
231 "or 'hg update -C' to lose changes")) | 230 "or 'hg update -C' to lose changes")) |
232 | 231 |
233 status = repo.status() | 232 status = repo.status() |
234 modified, added, removed, deleted, unknown = status[:5] | 233 modified, added, removed, deleted, unknown = status[:5] |
241 ma = repo.changectx(pa).manifest() | 240 ma = repo.changectx(pa).manifest() |
242 | 241 |
243 # resolve the manifest to determine which files | 242 # resolve the manifest to determine which files |
244 # we care about merging | 243 # we care about merging |
245 repo.ui.note(_("resolving manifests\n")) | 244 repo.ui.note(_("resolving manifests\n")) |
246 repo.ui.debug(_(" overwrite %s branchmerge %s partial %s linear %s\n") % | 245 repo.ui.debug(_(" overwrite %s branchmerge %s partial %s\n") % |
247 (overwrite, branchmerge, bool(partial), linear)) | 246 (overwrite, branchmerge, bool(partial))) |
248 repo.ui.debug(_(" ancestor %s local %s remote %s\n") % | 247 repo.ui.debug(_(" ancestor %s local %s remote %s\n") % |
249 (short(p1), short(p2), short(pa))) | 248 (short(p1), short(p2), short(pa))) |
250 | 249 |
251 action = [] | 250 action = [] |
252 m1 = workingmanifest(repo, m1, status) | 251 m1 = workingmanifest(repo, m1, status) |
253 | 252 |
254 if not force: | 253 if not force: |
255 checkunknown(repo, m2, status) | 254 checkunknown(repo, m2, status) |
256 if linear: | 255 if not branchmerge: |
257 action += forgetremoved(m2, status) | 256 action += forgetremoved(m2, status) |
258 action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards, partial) | 257 action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards, partial) |
259 del m1, m2, ma | 258 del m1, m2, ma |
260 | 259 |
261 ### apply phase | 260 ### apply phase |
262 | 261 |
263 if linear or overwrite: | 262 if not branchmerge: |
264 # we don't need to do any magic, just jump to the new rev | 263 # we don't need to do any magic, just jump to the new rev |
265 p1, p2 = p2, nullid | 264 p1, p2 = p2, nullid |
266 | 265 |
267 xp1, xp2 = hex(p1), hex(p2) | 266 xp1, xp2 = hex(p1), hex(p2) |
268 if p2 == nullid: xp2 = '' | 267 if p2 == nullid: xp2 = '' |