[PATCH 2 of 3 V5] shelve: make non bare shelve not saving branch information in bundle
liscju
piotr.listkiewicz at gmail.com
Sat Mar 12 18:32:54 EST 2016
# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1457387891 -3600
# Mon Mar 07 22:58:11 2016 +0100
# Node ID 9689c260e943f45c3bb0628f44ed7dc09c2f1bfb
# Parent 7ad2bc86e9efef062162649bf2747fd8533b81ed
shelve: make non bare shelve not saving branch information in bundle
This patch makes non bare shelve setting branch of working directory
to the first parent branch before commiting, making it not
remember newly created branch information in a bundle.
This patch prepares for restoring newly created branch only on
bare shelve, in other case it will not preserve information
about new branch.
diff -r 7ad2bc86e9ef -r 9689c260e943 hgext/shelve.py
--- a/hgext/shelve.py Sat Mar 12 18:36:31 2016 +0100
+++ b/hgext/shelve.py Mon Mar 07 22:58:11 2016 +0100
@@ -313,6 +313,11 @@ def _docreatecmd(ui, repo, pats, opts):
extra['shelve_unknown'] = '\0'.join(s.unknown)
repo[None].add(s.unknown)
+ if _iswctxonnewbranch(repo) and not _isbareshelve(pats, opts):
+ # In non-bare shelve we don't store newly created branch
+ # at bundled commit
+ repo.dirstate.setbranch(repo['.'].branch())
+
def commitfunc(ui, repo, message, match, opts):
hasmq = util.safehasattr(repo, 'mq')
if hasmq:
@@ -371,6 +376,9 @@ def _isbareshelve(pats, opts):
and not opts.get('include', False)
and not opts.get('exclude', False))
+def _iswctxonnewbranch(repo):
+ return repo[None].branch() != repo['.'].branch()
+
def cleanupcmd(ui, repo):
"""subcommand that deletes all shelves"""
More information about the Mercurial-devel
mailing list