# HG changeset patch # User Matt Mackall # Date 1447363590 21600 # Node ID 2fb17f60bffa550789b3b95c06ee1577c989cf1d # Parent eb49ffa39fe2706eaa0b7f1290334db31334bbef# Parent a7eecd021782f58ccfc478834f707d8a10581f22 merge with stable diff -r eb49ffa39fe2 -r 2fb17f60bffa hgext/share.py --- a/hgext/share.py Sat Nov 07 13:48:42 2015 -0500 +++ b/hgext/share.py Thu Nov 12 15:26:30 2015 -0600 @@ -123,7 +123,7 @@ def extsetup(ui): extensions.wrapfunction(bookmarks.bmstore, 'getbkfile', getbkfile) extensions.wrapfunction(bookmarks.bmstore, 'recordchange', recordchange) - extensions.wrapfunction(bookmarks.bmstore, 'write', write) + extensions.wrapfunction(bookmarks.bmstore, '_writerepo', writerepo) extensions.wrapcommand(commands.table, 'clone', clone) def _hassharedbookmarks(repo): @@ -166,10 +166,11 @@ category = 'share-bookmarks' tr.addpostclose(category, lambda tr: self._writerepo(srcrepo)) -def write(orig, self): +def writerepo(orig, self, repo): # First write local bookmarks file in case we ever unshare - orig(self) + orig(self, repo) + if _hassharedbookmarks(self._repo): srcrepo = _getsrcrepo(self._repo) if srcrepo is not None: - self._writerepo(srcrepo) + orig(self, srcrepo) diff -r eb49ffa39fe2 -r 2fb17f60bffa tests/test-shelve.t --- a/tests/test-shelve.t Sat Nov 07 13:48:42 2015 -0500 +++ b/tests/test-shelve.t Thu Nov 12 15:26:30 2015 -0600 @@ -1174,3 +1174,42 @@ rebase aborted $ hg up -C . 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cd .. + +Keep active bookmark while (un)shelving even on shared repo (issue4940) +----------------------------------------------------------------------- + + $ cat <> $HGRCPATH + > [extensions] + > share = + > EOF + + $ hg bookmarks -R repo + test 4:33f7f61e6c5e + $ hg share -B repo share + updating working directory + 6 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd share + + $ hg bookmarks + test 4:33f7f61e6c5e + $ hg bookmarks foo + $ hg bookmarks + * foo 5:703117a2acfb + test 4:33f7f61e6c5e + $ echo x >> x + $ hg shelve + shelved as foo + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg bookmarks + * foo 5:703117a2acfb + test 4:33f7f61e6c5e + + $ hg unshelve + unshelving change 'foo' + $ hg bookmarks + * foo 5:703117a2acfb + test 4:33f7f61e6c5e + + $ cd ..