Show More
@@ -111,7 +111,6 b' def update(repo, node, branchmerge=False' | |||||
111 | (short(man), short(m1n), short(m2n))) |
|
111 | (short(man), short(m1n), short(m2n))) | |
112 |
|
112 | |||
113 | action = {} |
|
113 | action = {} | |
114 | remove = [] |
|
|||
115 | forget = [] |
|
114 | forget = [] | |
116 |
|
115 | |||
117 | # update m1 from working dir |
|
116 | # update m1 from working dir | |
@@ -182,19 +181,19 b' def update(repo, node, branchmerge=False' | |||||
182 | (_(" local changed %s which remote deleted\n") % f) + |
|
181 | (_(" local changed %s which remote deleted\n") % f) + | |
183 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) |
|
182 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) | |
184 | if r == _("d"): |
|
183 | if r == _("d"): | |
185 | remove.append(f) |
|
184 | action[f] = (None, None, None) | |
186 | else: |
|
185 | else: | |
187 | repo.ui.debug(_("other deleted %s\n") % f) |
|
186 | repo.ui.debug(_("other deleted %s\n") % f) | |
188 | remove.append(f) # other deleted it |
|
187 | action[f] = (None, None, None) | |
189 | else: |
|
188 | else: | |
190 | # file is created on branch or in working directory |
|
189 | # file is created on branch or in working directory | |
191 | if overwrite and f not in umap: |
|
190 | if overwrite and f not in umap: | |
192 | repo.ui.debug(_("remote deleted %s, clobbering\n") % f) |
|
191 | repo.ui.debug(_("remote deleted %s, clobbering\n") % f) | |
193 | remove.append(f) |
|
192 | action[f] = (None, None, None) | |
194 | elif not n[20:]: # same as parent |
|
193 | elif not n[20:]: # same as parent | |
195 | if backwards: |
|
194 | if backwards: | |
196 | repo.ui.debug(_("remote deleted %s\n") % f) |
|
195 | repo.ui.debug(_("remote deleted %s\n") % f) | |
197 | remove.append(f) |
|
196 | action[f] = (None, None, None) | |
198 | else: |
|
197 | else: | |
199 | repo.ui.debug(_("local modified %s, keeping\n") % f) |
|
198 | repo.ui.debug(_("local modified %s, keeping\n") % f) | |
200 | else: |
|
199 | else: | |
@@ -238,51 +237,50 b' def update(repo, node, branchmerge=False' | |||||
238 |
|
237 | |||
239 | # update files |
|
238 | # update files | |
240 | unresolved = [] |
|
239 | unresolved = [] | |
241 | updated = 0 |
|
240 | updated, merged, removed = 0, 0, 0 | |
242 | merged = 0 |
|
|||
243 | files = action.keys() |
|
241 | files = action.keys() | |
244 | files.sort() |
|
242 | files.sort() | |
245 | for f in files: |
|
243 | for f in files: | |
246 | flag, my, other = action[f] |
|
244 | flag, my, other = action[f] | |
247 | if f[0] == "/": |
|
245 | if f[0] == "/": | |
248 | continue |
|
246 | continue | |
249 |
if |
|
247 | if not my: | |
|
248 | repo.ui.note(_("removing %s\n") % f) | |||
|
249 | util.audit_path(f) | |||
|
250 | try: | |||
|
251 | util.unlink(repo.wjoin(f)) | |||
|
252 | except OSError, inst: | |||
|
253 | if inst.errno != errno.ENOENT: | |||
|
254 | repo.ui.warn(_("update failed to remove %s: %s!\n") % | |||
|
255 | (f, inst.strerror)) | |||
|
256 | removed +=1 | |||
|
257 | elif other: | |||
250 | repo.ui.status(_("merging %s\n") % f) |
|
258 | repo.ui.status(_("merging %s\n") % f) | |
251 | if merge3(repo, f, my, other, xp1, xp2): |
|
259 | if merge3(repo, f, my, other, xp1, xp2): | |
252 | unresolved.append(f) |
|
260 | unresolved.append(f) | |
|
261 | util.set_exec(repo.wjoin(f), flag) | |||
253 | merged += 1 |
|
262 | merged += 1 | |
254 | else: |
|
263 | else: | |
255 | repo.ui.note(_("getting %s\n") % f) |
|
264 | repo.ui.note(_("getting %s\n") % f) | |
256 | t = repo.file(f).read(my) |
|
265 | t = repo.file(f).read(my) | |
257 | repo.wwrite(f, t) |
|
266 | repo.wwrite(f, t) | |
|
267 | util.set_exec(repo.wjoin(f), flag) | |||
258 | updated += 1 |
|
268 | updated += 1 | |
259 | util.set_exec(repo.wjoin(f), flag) |
|
|||
260 |
|
||||
261 | remove.sort() |
|
|||
262 | for f in remove: |
|
|||
263 | repo.ui.note(_("removing %s\n") % f) |
|
|||
264 | util.audit_path(f) |
|
|||
265 | try: |
|
|||
266 | util.unlink(repo.wjoin(f)) |
|
|||
267 | except OSError, inst: |
|
|||
268 | if inst.errno != errno.ENOENT: |
|
|||
269 | repo.ui.warn(_("update failed to remove %s: %s!\n") % |
|
|||
270 | (f, inst.strerror)) |
|
|||
271 |
|
269 | |||
272 | # update dirstate |
|
270 | # update dirstate | |
273 | if not partial: |
|
271 | if not partial: | |
274 | repo.dirstate.setparents(p1, p2) |
|
272 | repo.dirstate.setparents(p1, p2) | |
275 | repo.dirstate.forget(forget) |
|
273 | repo.dirstate.forget(forget) | |
276 | if branchmerge: |
|
|||
277 | repo.dirstate.update(remove, 'r') |
|
|||
278 | else: |
|
|||
279 | repo.dirstate.forget(remove) |
|
|||
280 |
|
||||
281 | files = action.keys() |
|
274 | files = action.keys() | |
282 | files.sort() |
|
275 | files.sort() | |
283 | for f in files: |
|
276 | for f in files: | |
284 | flag, my, other = action[f] |
|
277 | flag, my, other = action[f] | |
285 |
if not |
|
278 | if not my: | |
|
279 | if branchmerge: | |||
|
280 | repo.dirstate.update([f], 'r') | |||
|
281 | else: | |||
|
282 | repo.dirstate.forget([f]) | |||
|
283 | elif not other: | |||
286 | if branchmerge: |
|
284 | if branchmerge: | |
287 | repo.dirstate.update([f], 'n', st_mtime=-1) |
|
285 | repo.dirstate.update([f], 'n', st_mtime=-1) | |
288 | else: |
|
286 | else: | |
@@ -305,7 +303,7 b' def update(repo, node, branchmerge=False' | |||||
305 | if show_stats: |
|
303 | if show_stats: | |
306 | stats = ((updated, _("updated")), |
|
304 | stats = ((updated, _("updated")), | |
307 | (merged - len(unresolved), _("merged")), |
|
305 | (merged - len(unresolved), _("merged")), | |
308 |
( |
|
306 | (removed, _("removed")), | |
309 | (len(unresolved), _("unresolved"))) |
|
307 | (len(unresolved), _("unresolved"))) | |
310 | note = ", ".join([_("%d files %s") % s for s in stats]) |
|
308 | note = ", ".join([_("%d files %s") % s for s in stats]) | |
311 | repo.ui.status("%s\n" % note) |
|
309 | repo.ui.status("%s\n" % note) |
General Comments 0
You need to be logged in to leave comments.
Login now