##// END OF EJS Templates
bookmarks: use recordchange instead of writing if transaction is active...
FUJIWARA Katsunori -
r26520:46dec89f default
parent child Browse files
Show More
@@ -253,12 +253,11 b' def createcmd(ui, repo, pats, opts):'
253
253
254 name = opts['name']
254 name = opts['name']
255
255
256 wlock = lock = tr = bms = None
256 wlock = lock = tr = None
257 try:
257 try:
258 wlock = repo.wlock()
258 wlock = repo.wlock()
259 lock = repo.lock()
259 lock = repo.lock()
260
260
261 bms = repo._bookmarks.copy()
262 # use an uncommitted transaction to generate the bundle to avoid
261 # use an uncommitted transaction to generate the bundle to avoid
263 # pull races. ensure we don't print the abort message to stderr.
262 # pull races. ensure we don't print the abort message to stderr.
264 tr = repo.transaction('commit', report=lambda x: None)
263 tr = repo.transaction('commit', report=lambda x: None)
@@ -313,10 +312,6 b' def createcmd(ui, repo, pats, opts):'
313 ui.status(_('shelved as %s\n') % name)
312 ui.status(_('shelved as %s\n') % name)
314 hg.update(repo, parent.node())
313 hg.update(repo, parent.node())
315 finally:
314 finally:
316 if bms:
317 # restore old bookmarks
318 repo._bookmarks.update(bms)
319 repo._bookmarks.write()
320 if tr:
315 if tr:
321 tr.abort()
316 tr.abort()
322 lockmod.release(lock, wlock)
317 lockmod.release(lock, wlock)
@@ -95,6 +95,14 b' class bmstore(dict):'
95 l = repo._wlockref and repo._wlockref()
95 l = repo._wlockref and repo._wlockref()
96 if l is None or not l.held:
96 if l is None or not l.held:
97 repo.ui.develwarn('bookmarks write with no wlock')
97 repo.ui.develwarn('bookmarks write with no wlock')
98
99 tr = repo.currenttransaction()
100 if tr:
101 self.recordchange(tr)
102 # invalidatevolatilesets() is omitted because this doesn't
103 # write changes out actually
104 return
105
98 self._writerepo(repo)
106 self._writerepo(repo)
99 repo.invalidatevolatilesets()
107 repo.invalidatevolatilesets()
100
108
@@ -534,8 +534,12 b' shelve should still work even if mq is d'
534 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
534 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
535 $ hg --config extensions.mq=! shelve --list
535 $ hg --config extensions.mq=! shelve --list
536 test (*) changes to 'create conflict' (glob)
536 test (*) changes to 'create conflict' (glob)
537 $ hg bookmark
538 * test 4:33f7f61e6c5e
537 $ hg --config extensions.mq=! unshelve
539 $ hg --config extensions.mq=! unshelve
538 unshelving change 'test'
540 unshelving change 'test'
541 $ hg bookmark
542 * test 4:33f7f61e6c5e
539
543
540 shelve should leave dirstate clean (issue4055)
544 shelve should leave dirstate clean (issue4055)
541
545
@@ -796,6 +800,8 b' Recreate some conflict again'
796 $ hg up test
800 $ hg up test
797 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
801 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
798 (activating bookmark test)
802 (activating bookmark test)
803 $ hg bookmark
804 * test 4:33f7f61e6c5e
799 $ hg unshelve
805 $ hg unshelve
800 unshelving change 'default'
806 unshelving change 'default'
801 rebasing shelved changes
807 rebasing shelved changes
@@ -805,6 +811,8 b' Recreate some conflict again'
805 merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark')
811 merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark')
806 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
812 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
807 [1]
813 [1]
814 $ hg bookmark
815 test 4:33f7f61e6c5e
808
816
809 Test that resolving all conflicts in one direction (so that the rebase
817 Test that resolving all conflicts in one direction (so that the rebase
810 is a no-op), works (issue4398)
818 is a no-op), works (issue4398)
@@ -817,6 +825,8 b' is a no-op), works (issue4398)'
817 rebasing 5:4b555fdb4e96 "changes to 'second'" (tip)
825 rebasing 5:4b555fdb4e96 "changes to 'second'" (tip)
818 note: rebase of 5:4b555fdb4e96 created no changes to commit
826 note: rebase of 5:4b555fdb4e96 created no changes to commit
819 unshelve of 'default' complete
827 unshelve of 'default' complete
828 $ hg bookmark
829 * test 4:33f7f61e6c5e
820 $ hg diff
830 $ hg diff
821 $ hg status
831 $ hg status
822 ? a/a.orig
832 ? a/a.orig
@@ -900,12 +910,16 b' Test interactive shelve'
900 $ hg st
910 $ hg st
901 M a/a
911 M a/a
902 ? foo/foo
912 ? foo/foo
913 $ hg bookmark
914 * test 4:33f7f61e6c5e
903 $ hg unshelve
915 $ hg unshelve
904 unshelving change 'test'
916 unshelving change 'test'
905 temporarily committing pending changes (restore with 'hg unshelve --abort')
917 temporarily committing pending changes (restore with 'hg unshelve --abort')
906 rebasing shelved changes
918 rebasing shelved changes
907 rebasing 6:65b5d1c34c34 "changes to 'create conflict'" (tip)
919 rebasing 6:65b5d1c34c34 "changes to 'create conflict'" (tip)
908 merging a/a
920 merging a/a
921 $ hg bookmark
922 * test 4:33f7f61e6c5e
909 $ cat a/a
923 $ cat a/a
910 a
924 a
911 a
925 a
@@ -917,6 +931,7 b' shelve --patch and shelve --stat should '
917
931
918 $ hg up --clean .
932 $ hg up --clean .
919 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
933 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
934 (leaving bookmark test)
920 $ hg shelve --list
935 $ hg shelve --list
921 $ echo 'patch a' > shelf-patch-a
936 $ echo 'patch a' > shelf-patch-a
922 $ hg add shelf-patch-a
937 $ hg add shelf-patch-a
General Comments 0
You need to be logged in to leave comments. Login now