comparison mercurial/scmutil.py @ 27851:4133a306606c

with: use context manager in _markchanges
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents 22e362da27cf
children 52a4ad62b006
comparison
equal deleted inserted replaced
27850:49cfddbf54ba 27851:4133a306606c
981 981
982 def _markchanges(repo, unknown, deleted, renames): 982 def _markchanges(repo, unknown, deleted, renames):
983 '''Marks the files in unknown as added, the files in deleted as removed, 983 '''Marks the files in unknown as added, the files in deleted as removed,
984 and the files in renames as copied.''' 984 and the files in renames as copied.'''
985 wctx = repo[None] 985 wctx = repo[None]
986 wlock = repo.wlock() 986 with repo.wlock():
987 try:
988 wctx.forget(deleted) 987 wctx.forget(deleted)
989 wctx.add(unknown) 988 wctx.add(unknown)
990 for new, old in renames.iteritems(): 989 for new, old in renames.iteritems():
991 wctx.copy(old, new) 990 wctx.copy(old, new)
992 finally:
993 wlock.release()
994 991
995 def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None): 992 def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None):
996 """Update the dirstate to reflect the intent of copying src to dst. For 993 """Update the dirstate to reflect the intent of copying src to dst. For
997 different reasons it might not end with dst being marked as copied from src. 994 different reasons it might not end with dst being marked as copied from src.
998 """ 995 """