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