comparison mercurial/merge.py @ 2826:3aeab7bb5adc

Refactor update locking slightly
author Matt Mackall <mpm@selenic.com>
date Tue, 08 Aug 2006 09:19:20 -0500
parents 1ea086bc2086
children 56f99f5aab34
comparison
equal deleted inserted replaced
2825:1ea086bc2086 2826:3aeab7bb5adc
47 os.unlink(c) 47 os.unlink(c)
48 return r 48 return r
49 49
50 def update(repo, node, branchmerge=False, force=False, partial=None, 50 def update(repo, node, branchmerge=False, force=False, partial=None,
51 forcemerge=False, wlock=None, show_stats=True, remind=True): 51 forcemerge=False, wlock=None, show_stats=True, remind=True):
52
53 if not wlock:
54 wlock = repo.wlock()
55
52 pl = repo.dirstate.parents() 56 pl = repo.dirstate.parents()
53 if not force and pl[1] != nullid: 57 if not force and pl[1] != nullid:
54 raise util.Abort(_("outstanding uncommitted merges")) 58 raise util.Abort(_("outstanding uncommitted merges"))
55 59
56 err = False 60 err = False
107 umap = dict.fromkeys(unknown) 111 umap = dict.fromkeys(unknown)
108 112
109 for f in added + modified + unknown: 113 for f in added + modified + unknown:
110 mw[f] = "" 114 mw[f] = ""
111 mfw[f] = util.is_exec(repo.wjoin(f), mfw.get(f, False)) 115 mfw[f] = util.is_exec(repo.wjoin(f), mfw.get(f, False))
112
113 if not partial and not wlock: wlock = repo.wlock()
114 116
115 for f in deleted + removed: 117 for f in deleted + removed:
116 if f in mw: 118 if f in mw:
117 del mw[f] 119 del mw[f]
118 120