hgext/shelve.py
changeset 28572 43c204ddf333
parent 28571 3f0e25e89e28
child 28573 6a42564081cb
--- a/hgext/shelve.py	Sat Mar 12 18:36:31 2016 +0100
+++ b/hgext/shelve.py	Mon Mar 07 22:58:11 2016 +0100
@@ -334,6 +334,11 @@
                 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:
@@ -392,6 +397,9 @@
             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"""