comparison mercurial/commands.py @ 2272:e9a0ed9ed4d9

revert: fix corner case found by faheem mitha. if file not in dest manifest, remove only if in source manifest.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 11 May 2006 22:10:47 -0700
parents 6c9305fbebaf
children e506c14382fd
comparison
equal deleted inserted replaced
2271:90b122730d32 2272:e9a0ed9ed4d9
2275 elif p2 != nullid: 2275 elif p2 != nullid:
2276 raise util.Abort(_('working dir has two parents; ' 2276 raise util.Abort(_('working dir has two parents; '
2277 'you must specify the revision to revert to')) 2277 'you must specify the revision to revert to'))
2278 else: 2278 else:
2279 node = parent 2279 node = parent
2280 pmf = None
2280 mf = repo.manifest.read(repo.changelog.read(node)[0]) 2281 mf = repo.manifest.read(repo.changelog.read(node)[0])
2281 2282
2282 wlock = repo.wlock() 2283 wlock = repo.wlock()
2283 2284
2284 # need all matching names in dirstate and manifest of target rev, 2285 # need all matching names in dirstate and manifest of target rev,
2357 # file has not changed in dirstate 2358 # file has not changed in dirstate
2358 if node == parent: 2359 if node == parent:
2359 if exact: ui.warn(_('no changes needed to %s\n' % rel)) 2360 if exact: ui.warn(_('no changes needed to %s\n' % rel))
2360 continue 2361 continue
2361 if not in_mf: 2362 if not in_mf:
2362 handle(remove, False) 2363 if pmf is None:
2364 # only need parent manifest in this unlikely case,
2365 # so do not read by default
2366 pmf = repo.manifest.read(repo.changelog.read(parent)[0])
2367 if abs in pmf:
2368 handle(remove, False)
2363 update[abs] = True 2369 update[abs] = True
2364 2370
2365 repo.dirstate.forget(forget[0]) 2371 repo.dirstate.forget(forget[0])
2366 r = repo.update(node, False, True, update.has_key, False, wlock=wlock, 2372 r = repo.update(node, False, True, update.has_key, False, wlock=wlock,
2367 show_stats=False) 2373 show_stats=False)