Mercurial > hg
comparison hgext/mq.py @ 14620:2b9c32929e62
mq: make qrefresh/qfold keep wlock until saving patch status
Because q.refresh() changes nodeid, .hg/patches/status gets invalid until
q.savedirty(). This patch changes mq not to unlock repository of incomplete
state.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 15 Jun 2011 01:50:49 +0900 |
parents | 17c16bcf6926 |
children | 217b7d83afc3 |
comparison
equal
deleted
inserted
replaced
14619:29f55c0e39e7 | 14620:2b9c32929e62 |
---|---|
2273 ph = patchheader(q.join(patch), q.plainmode) | 2273 ph = patchheader(q.join(patch), q.plainmode) |
2274 message = ui.edit('\n'.join(ph.message), ph.user or ui.username()) | 2274 message = ui.edit('\n'.join(ph.message), ph.user or ui.username()) |
2275 # We don't want to lose the patch message if qrefresh fails (issue2062) | 2275 # We don't want to lose the patch message if qrefresh fails (issue2062) |
2276 repo.savecommitmessage(message) | 2276 repo.savecommitmessage(message) |
2277 setupheaderopts(ui, opts) | 2277 setupheaderopts(ui, opts) |
2278 ret = q.refresh(repo, pats, msg=message, **opts) | 2278 wlock = repo.wlock() |
2279 q.savedirty() | 2279 try: |
2280 return ret | 2280 ret = q.refresh(repo, pats, msg=message, **opts) |
2281 q.savedirty() | |
2282 return ret | |
2283 finally: | |
2284 wlock.release() | |
2281 | 2285 |
2282 @command("^qdiff", | 2286 @command("^qdiff", |
2283 commands.diffopts + commands.diffopts2 + commands.walkopts, | 2287 commands.diffopts + commands.diffopts2 + commands.walkopts, |
2284 _('hg qdiff [OPTION]... [FILE]...')) | 2288 _('hg qdiff [OPTION]... [FILE]...')) |
2285 def diff(ui, repo, *pats, **opts): | 2289 def diff(ui, repo, *pats, **opts): |
2364 | 2368 |
2365 if opts.get('edit'): | 2369 if opts.get('edit'): |
2366 message = ui.edit(message, user or ui.username()) | 2370 message = ui.edit(message, user or ui.username()) |
2367 | 2371 |
2368 diffopts = q.patchopts(q.diffopts(), *patches) | 2372 diffopts = q.patchopts(q.diffopts(), *patches) |
2369 q.refresh(repo, msg=message, git=diffopts.git) | 2373 wlock = repo.wlock() |
2370 q.delete(repo, patches, opts) | 2374 try: |
2371 q.savedirty() | 2375 q.refresh(repo, msg=message, git=diffopts.git) |
2376 q.delete(repo, patches, opts) | |
2377 q.savedirty() | |
2378 finally: | |
2379 wlock.release() | |
2372 | 2380 |
2373 @command("qgoto", | 2381 @command("qgoto", |
2374 [('f', 'force', None, _('overwrite any local changes'))], | 2382 [('f', 'force', None, _('overwrite any local changes'))], |
2375 _('hg qgoto [OPTION]... PATCH')) | 2383 _('hg qgoto [OPTION]... PATCH')) |
2376 def goto(ui, repo, patch, **opts): | 2384 def goto(ui, repo, patch, **opts): |