equal
deleted
inserted
replaced
270 wctx = repo[None] |
270 wctx = repo[None] |
271 parents = wctx.parents() |
271 parents = wctx.parents() |
272 if len(parents) > 1: |
272 if len(parents) > 1: |
273 raise error.Abort(_('cannot shelve while merging')) |
273 raise error.Abort(_('cannot shelve while merging')) |
274 parent = parents[0] |
274 parent = parents[0] |
|
275 origbranch = wctx.branch() |
275 |
276 |
276 # we never need the user, so we use a generic user for all shelve operations |
277 # we never need the user, so we use a generic user for all shelve operations |
277 user = 'shelve@localhost' |
278 user = 'shelve@localhost' |
278 label = repo._activebookmark or parent.branch() or 'default' |
279 label = repo._activebookmark or parent.branch() or 'default' |
279 |
280 |
376 |
377 |
377 if ui.formatted(): |
378 if ui.formatted(): |
378 desc = util.ellipsis(desc, ui.termwidth()) |
379 desc = util.ellipsis(desc, ui.termwidth()) |
379 ui.status(_('shelved as %s\n') % name) |
380 ui.status(_('shelved as %s\n') % name) |
380 hg.update(repo, parent.node()) |
381 hg.update(repo, parent.node()) |
|
382 if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): |
|
383 repo.dirstate.setbranch(origbranch) |
381 |
384 |
382 _aborttransaction(repo) |
385 _aborttransaction(repo) |
383 finally: |
386 finally: |
384 lockmod.release(tr, lock) |
387 lockmod.release(tr, lock) |
|
388 |
|
389 def _isbareshelve(pats, opts): |
|
390 return (not pats |
|
391 and not opts.get('interactive', False) |
|
392 and not opts.get('include', False) |
|
393 and not opts.get('exclude', False)) |
385 |
394 |
386 def cleanupcmd(ui, repo): |
395 def cleanupcmd(ui, repo): |
387 """subcommand that deletes all shelves""" |
396 """subcommand that deletes all shelves""" |
388 |
397 |
389 with repo.wlock(): |
398 with repo.wlock(): |