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