Show More
@@ -342,7 +342,7 b' class workingctx(changectx):' | |||||
342 | def _buildmanifest(self): |
|
342 | def _buildmanifest(self): | |
343 | """generate a manifest corresponding to the working directory""" |
|
343 | """generate a manifest corresponding to the working directory""" | |
344 |
|
344 | |||
345 | man = self._parents[0].manifest().coy() |
|
345 | man = self._parents[0].manifest().copy() | |
346 | copied = self._repo.dirstate.copies() |
|
346 | copied = self._repo.dirstate.copies() | |
347 | modified, added, removed, deleted, unknown = self._status[:5] |
|
347 | modified, added, removed, deleted, unknown = self._status[:5] | |
348 | for i,l in (("a", added), ("m", modified), ("u", unknown)): |
|
348 | for i,l in (("a", added), ("m", modified), ("u", unknown)): |
@@ -321,6 +321,9 b' class localrepository(repo.repository):' | |||||
321 | def changectx(self, changeid=None): |
|
321 | def changectx(self, changeid=None): | |
322 | return context.changectx(self, changeid) |
|
322 | return context.changectx(self, changeid) | |
323 |
|
323 | |||
|
324 | def workingctx(self): | |||
|
325 | return context.workingctx(self) | |||
|
326 | ||||
324 | def parents(self, changeid=None): |
|
327 | def parents(self, changeid=None): | |
325 | ''' |
|
328 | ''' | |
326 | get list of changectxs for parents of changeid or working directory |
|
329 | get list of changectxs for parents of changeid or working directory |
@@ -59,35 +59,17 b' def filemerge(repo, fw, fo, fd, my, othe' | |||||
59 | os.unlink(c) |
|
59 | os.unlink(c) | |
60 | return r |
|
60 | return r | |
61 |
|
61 | |||
62 |
def checkunknown(repo, m2, |
|
62 | def checkunknown(repo, m2, wctx): | |
63 | """ |
|
63 | """ | |
64 | check for collisions between unknown files and files in m2 |
|
64 | check for collisions between unknown files and files in m2 | |
65 | """ |
|
65 | """ | |
66 | modified, added, removed, deleted, unknown = status[:5] |
|
66 | for f in wctx.unknown(): | |
67 | for f in unknown: |
|
|||
68 | if f in m2: |
|
67 | if f in m2: | |
69 | if repo.file(f).cmp(m2[f], repo.wread(f)): |
|
68 | if repo.file(f).cmp(m2[f], repo.wread(f)): | |
70 | raise util.Abort(_("'%s' already exists in the working" |
|
69 | raise util.Abort(_("'%s' already exists in the working" | |
71 | " dir and differs from remote") % f) |
|
70 | " dir and differs from remote") % f) | |
72 |
|
71 | |||
73 | def workingmanifest(repo, man, status): |
|
72 | def forgetremoved(m2, wctx): | |
74 | """ |
|
|||
75 | Update manifest to correspond to the working directory |
|
|||
76 | """ |
|
|||
77 |
|
||||
78 | copied = repo.dirstate.copies() |
|
|||
79 | modified, added, removed, deleted, unknown = status[:5] |
|
|||
80 | for i,l in (("a", added), ("m", modified), ("u", unknown)): |
|
|||
81 | for f in l: |
|
|||
82 | man[f] = man.get(copied.get(f, f), nullid) + i |
|
|||
83 | man.set(f, util.is_exec(repo.wjoin(f), man.execf(f))) |
|
|||
84 |
|
||||
85 | for f in deleted + removed: |
|
|||
86 | del man[f] |
|
|||
87 |
|
||||
88 | return man |
|
|||
89 |
|
||||
90 | def forgetremoved(m2, status): |
|
|||
91 | """ |
|
73 | """ | |
92 | Forget removed files |
|
74 | Forget removed files | |
93 |
|
75 | |||
@@ -98,10 +80,9 b' def forgetremoved(m2, status):' | |||||
98 | manifest. |
|
80 | manifest. | |
99 | """ |
|
81 | """ | |
100 |
|
82 | |||
101 | modified, added, removed, deleted, unknown = status[:5] |
|
|||
102 | action = [] |
|
83 | action = [] | |
103 |
|
84 | |||
104 | for f in deleted + removed: |
|
85 | for f in wctx.deleted() + wctx.removed(): | |
105 | if f not in m2: |
|
86 | if f not in m2: | |
106 | action.append((f, "f")) |
|
87 | action.append((f, "f")) | |
107 |
|
88 | |||
@@ -332,7 +313,8 b' def update(repo, node, branchmerge=False' | |||||
332 |
|
313 | |||
333 | ### check phase |
|
314 | ### check phase | |
334 |
|
315 | |||
335 |
|
|
316 | wc = repo.workingctx() | |
|
317 | pl = wc.parents() | |||
336 | if not overwrite and len(pl) > 1: |
|
318 | if not overwrite and len(pl) > 1: | |
337 | raise util.Abort(_("outstanding uncommitted merges")) |
|
319 | raise util.Abort(_("outstanding uncommitted merges")) | |
338 |
|
320 | |||
@@ -351,13 +333,11 b' def update(repo, node, branchmerge=False' | |||||
351 | raise util.Abort(_("update spans branches, use 'hg merge' " |
|
333 | raise util.Abort(_("update spans branches, use 'hg merge' " | |
352 | "or 'hg update -C' to lose changes")) |
|
334 | "or 'hg update -C' to lose changes")) | |
353 |
|
335 | |||
354 | status = repo.status() |
|
|||
355 | modified, added, removed, deleted, unknown = status[:5] |
|
|||
356 | if branchmerge and not forcemerge: |
|
336 | if branchmerge and not forcemerge: | |
357 | if modified or added or removed: |
|
337 | if wc.modified() or wc.added() or wc.removed(): | |
358 | raise util.Abort(_("outstanding uncommitted changes")) |
|
338 | raise util.Abort(_("outstanding uncommitted changes")) | |
359 |
|
339 | |||
360 |
m1 = |
|
340 | m1 = wc.manifest().copy() | |
361 | m2 = p2.manifest().copy() |
|
341 | m2 = p2.manifest().copy() | |
362 | ma = pa.manifest() |
|
342 | ma = pa.manifest() | |
363 |
|
343 | |||
@@ -371,14 +351,13 b' def update(repo, node, branchmerge=False' | |||||
371 | action = [] |
|
351 | action = [] | |
372 | copy = {} |
|
352 | copy = {} | |
373 |
|
353 | |||
374 | m1 = workingmanifest(repo, m1, status) |
|
|||
375 | filtermanifest(m1, partial) |
|
354 | filtermanifest(m1, partial) | |
376 | filtermanifest(m2, partial) |
|
355 | filtermanifest(m2, partial) | |
377 |
|
356 | |||
378 | if not force: |
|
357 | if not force: | |
379 |
checkunknown(repo, m2, |
|
358 | checkunknown(repo, m2, wc) | |
380 | if not branchmerge: |
|
359 | if not branchmerge: | |
381 |
action += forgetremoved(m2, |
|
360 | action += forgetremoved(m2, wc) | |
382 | if not (backwards or overwrite): |
|
361 | if not (backwards or overwrite): | |
383 | copy = findcopies(repo, m1, m2, pa.rev()) |
|
362 | copy = findcopies(repo, m1, m2, pa.rev()) | |
384 |
|
363 |
General Comments 0
You need to be logged in to leave comments.
Login now