##// END OF EJS Templates
fetch: lock repo across pull and commit
Vadim Gelfer -
r2825:0496cfb0 default
parent child Browse files
Show More
@@ -46,7 +46,7 b" def fetch(ui, repo, source='default', **"
46 46 message = (commands.logmessage(opts) or
47 47 (_('Automated merge with %s') % other.url()))
48 48 n = repo.commit(mod + add + rem, message,
49 opts['user'], opts['date'],
49 opts['user'], opts['date'], lock=lock,
50 50 force_editor=opts.get('force_editor'))
51 51 ui.status(_('new changeset %d:%s merges remote changes '
52 52 'with local\n') % (repo.changelog.rev(n),
@@ -61,7 +61,7 b" def fetch(ui, repo, source='default', **"
61 61 raise util.Abort(_("fetch -r doesn't work for remote repositories yet"))
62 62 elif opts['rev']:
63 63 revs = [other.lookup(rev) for rev in opts['rev']]
64 modheads = repo.pull(other, heads=revs)
64 modheads = repo.pull(other, heads=revs, lock=lock)
65 65 return postincoming(other, modheads)
66 66
67 67 parent, p2 = repo.dirstate.parents()
@@ -76,7 +76,11 b" def fetch(ui, repo, source='default', **"
76 76 if len(repo.heads()) > 1:
77 77 raise util.Abort(_('multiple heads in this repository '
78 78 '(use "hg heads" and "hg merge" to merge them)'))
79 return pull()
79 lock = repo.lock()
80 try:
81 return pull()
82 finally:
83 lock.release()
80 84
81 85 cmdtable = {
82 86 'fetch':
General Comments 0
You need to be logged in to leave comments. Login now