Show More
@@ -21,7 +21,7 b' import minirst, revset, fileset' | |||||
21 | import dagparser, context, simplemerge, graphmod, copies |
|
21 | import dagparser, context, simplemerge, graphmod, copies | |
22 | import random |
|
22 | import random | |
23 | import setdiscovery, treediscovery, dagutil, pvec, localrepo |
|
23 | import setdiscovery, treediscovery, dagutil, pvec, localrepo | |
24 | import phases, obsolete, exchange, bundle2, repair |
|
24 | import phases, obsolete, exchange, bundle2, repair, lock as lockmod | |
25 | import ui as uimod |
|
25 | import ui as uimod | |
26 |
|
26 | |||
27 | table = {} |
|
27 | table = {} | |
@@ -976,11 +976,14 b' def bookmark(ui, repo, *names, **opts):' | |||||
976 | raise util.Abort(_("bookmark name required")) |
|
976 | raise util.Abort(_("bookmark name required")) | |
977 |
|
977 | |||
978 | if delete or rename or names or inactive: |
|
978 | if delete or rename or names or inactive: | |
979 |
wlock = |
|
979 | wlock = lock = tr = None | |
980 | try: |
|
980 | try: | |
|
981 | wlock = repo.wlock() | |||
|
982 | lock = repo.lock() | |||
981 | cur = repo.changectx('.').node() |
|
983 | cur = repo.changectx('.').node() | |
982 | marks = repo._bookmarks |
|
984 | marks = repo._bookmarks | |
983 | if delete: |
|
985 | if delete: | |
|
986 | tr = repo.transaction('bookmark') | |||
984 | for mark in names: |
|
987 | for mark in names: | |
985 | if mark not in marks: |
|
988 | if mark not in marks: | |
986 | raise util.Abort(_("bookmark '%s' does not exist") % |
|
989 | raise util.Abort(_("bookmark '%s' does not exist") % | |
@@ -988,9 +991,9 b' def bookmark(ui, repo, *names, **opts):' | |||||
988 | if mark == repo._activebookmark: |
|
991 | if mark == repo._activebookmark: | |
989 | bookmarks.deactivate(repo) |
|
992 | bookmarks.deactivate(repo) | |
990 | del marks[mark] |
|
993 | del marks[mark] | |
991 | marks.write() |
|
|||
992 |
|
994 | |||
993 | elif rename: |
|
995 | elif rename: | |
|
996 | tr = repo.transaction('bookmark') | |||
994 | if not names: |
|
997 | if not names: | |
995 | raise util.Abort(_("new bookmark name required")) |
|
998 | raise util.Abort(_("new bookmark name required")) | |
996 | elif len(names) > 1: |
|
999 | elif len(names) > 1: | |
@@ -1003,9 +1006,8 b' def bookmark(ui, repo, *names, **opts):' | |||||
1003 | if repo._activebookmark == rename and not inactive: |
|
1006 | if repo._activebookmark == rename and not inactive: | |
1004 | bookmarks.activate(repo, mark) |
|
1007 | bookmarks.activate(repo, mark) | |
1005 | del marks[rename] |
|
1008 | del marks[rename] | |
1006 | marks.write() |
|
|||
1007 |
|
||||
1008 | elif names: |
|
1009 | elif names: | |
|
1010 | tr = repo.transaction('bookmark') | |||
1009 | newact = None |
|
1011 | newact = None | |
1010 | for mark in names: |
|
1012 | for mark in names: | |
1011 | mark = checkformat(mark) |
|
1013 | mark = checkformat(mark) | |
@@ -1023,8 +1025,6 b' def bookmark(ui, repo, *names, **opts):' | |||||
1023 | bookmarks.activate(repo, newact) |
|
1025 | bookmarks.activate(repo, newact) | |
1024 | elif cur != tgt and newact == repo._activebookmark: |
|
1026 | elif cur != tgt and newact == repo._activebookmark: | |
1025 | bookmarks.deactivate(repo) |
|
1027 | bookmarks.deactivate(repo) | |
1026 | marks.write() |
|
|||
1027 |
|
||||
1028 | elif inactive: |
|
1028 | elif inactive: | |
1029 | if len(marks) == 0: |
|
1029 | if len(marks) == 0: | |
1030 | ui.status(_("no bookmarks set\n")) |
|
1030 | ui.status(_("no bookmarks set\n")) | |
@@ -1032,8 +1032,11 b' def bookmark(ui, repo, *names, **opts):' | |||||
1032 | ui.status(_("no active bookmark\n")) |
|
1032 | ui.status(_("no active bookmark\n")) | |
1033 | else: |
|
1033 | else: | |
1034 | bookmarks.deactivate(repo) |
|
1034 | bookmarks.deactivate(repo) | |
|
1035 | if tr is not None: | |||
|
1036 | marks.recordchange(tr) | |||
|
1037 | tr.close() | |||
1035 | finally: |
|
1038 | finally: | |
1036 |
|
|
1039 | lockmod.release(tr, lock, wlock) | |
1037 | else: # show bookmarks |
|
1040 | else: # show bookmarks | |
1038 | fm = ui.formatter('bookmarks', opts) |
|
1041 | fm = ui.formatter('bookmarks', opts) | |
1039 | hexfn = fm.hexfunc |
|
1042 | hexfn = fm.hexfunc |
@@ -63,55 +63,3 b' list bookmarks' | |||||
63 | $ hg book |
|
63 | $ hg book | |
64 | test 0:5c9ad3787638 |
|
64 | test 0:5c9ad3787638 | |
65 | test2 0:5c9ad3787638 |
|
65 | test2 0:5c9ad3787638 | |
66 |
|
||||
67 | immediate rollback and reentrancy issue |
|
|||
68 |
|
||||
69 | $ echo "mq=!" >> $HGRCPATH |
|
|||
70 | $ hg init repo |
|
|||
71 | $ cd repo |
|
|||
72 | $ echo a > a |
|
|||
73 | $ hg ci -Am adda |
|
|||
74 | adding a |
|
|||
75 | $ echo b > b |
|
|||
76 | $ hg ci -Am addb |
|
|||
77 | adding b |
|
|||
78 | $ hg bookmarks markb |
|
|||
79 | $ hg rollback |
|
|||
80 | repository tip rolled back to revision 0 (undo commit) |
|
|||
81 | working directory now based on revision 0 |
|
|||
82 |
|
||||
83 | are you there? |
|
|||
84 |
|
||||
85 | $ hg bookmarks |
|
|||
86 | no bookmarks set |
|
|||
87 |
|
||||
88 | can we commit? (issue2692) |
|
|||
89 |
|
||||
90 | $ echo c > c |
|
|||
91 | $ hg ci -Am rockon |
|
|||
92 | adding c |
|
|||
93 |
|
||||
94 | can you be added again? |
|
|||
95 |
|
||||
96 | $ hg bookmarks markb |
|
|||
97 | $ hg bookmarks |
|
|||
98 | * markb 1:fdb34407462c |
|
|||
99 |
|
||||
100 | rollback dry run with rollback information |
|
|||
101 |
|
||||
102 | $ hg rollback -n |
|
|||
103 | repository tip rolled back to revision 0 (undo commit) |
|
|||
104 | $ hg bookmarks |
|
|||
105 | * markb 1:fdb34407462c |
|
|||
106 |
|
||||
107 | rollback dry run with rollback information and no commit undo |
|
|||
108 |
|
||||
109 | $ rm .hg/store/undo |
|
|||
110 | $ hg rollback -n |
|
|||
111 | no rollback information available |
|
|||
112 | [1] |
|
|||
113 | $ hg bookmarks |
|
|||
114 | * markb 1:fdb34407462c |
|
|||
115 |
|
||||
116 | $ cd .. |
|
|||
117 |
|
@@ -403,10 +403,15 b' test id' | |||||
403 | test rollback |
|
403 | test rollback | |
404 |
|
404 | |||
405 | $ echo foo > f1 |
|
405 | $ echo foo > f1 | |
|
406 | $ hg bookmark tmp-rollback | |||
406 | $ hg ci -Amr |
|
407 | $ hg ci -Amr | |
407 | adding f1 |
|
408 | adding f1 | |
408 |
$ hg bookmark |
|
409 | $ hg bookmarks | |
409 | $ hg bookmark -f Z -r 1 |
|
410 | X2 1:925d80f479bb | |
|
411 | Y 2:db815d6d32e6 | |||
|
412 | Z 2:db815d6d32e6 | |||
|
413 | * tmp-rollback 3:2bf5cfec5864 | |||
|
414 | x y 2:db815d6d32e6 | |||
410 |
$ |
|
415 | $ hg rollback | |
411 | repository tip rolled back to revision 2 (undo commit) |
|
416 | repository tip rolled back to revision 2 (undo commit) | |
412 | working directory now based on revision 2 |
|
417 | working directory now based on revision 2 | |
@@ -414,7 +419,18 b' test rollback' | |||||
414 | X2 1:925d80f479bb |
|
419 | X2 1:925d80f479bb | |
415 | Y 2:db815d6d32e6 |
|
420 | Y 2:db815d6d32e6 | |
416 | Z 2:db815d6d32e6 |
|
421 | Z 2:db815d6d32e6 | |
|
422 | * tmp-rollback 2:db815d6d32e6 | |||
417 | x y 2:db815d6d32e6 |
|
423 | x y 2:db815d6d32e6 | |
|
424 | $ hg bookmark -f Z -r 1 | |||
|
425 | $ hg rollback | |||
|
426 | repository tip rolled back to revision 2 (undo bookmark) | |||
|
427 | $ hg bookmarks | |||
|
428 | X2 1:925d80f479bb | |||
|
429 | Y 2:db815d6d32e6 | |||
|
430 | Z 2:db815d6d32e6 | |||
|
431 | * tmp-rollback 2:db815d6d32e6 | |||
|
432 | x y 2:db815d6d32e6 | |||
|
433 | $ hg bookmark -d tmp-rollback | |||
418 |
|
434 | |||
419 | activate bookmark on working dir parent without --force |
|
435 | activate bookmark on working dir parent without --force | |
420 |
|
436 |
@@ -173,36 +173,66 b' pull empty' | |||||
173 | add extra data to test their exchange during push |
|
173 | add extra data to test their exchange during push | |
174 |
|
174 | |||
175 | $ hg -R main bookmark --rev eea13746799a book_eea1 |
|
175 | $ hg -R main bookmark --rev eea13746799a book_eea1 | |
|
176 | pre-close-tip:02de42196ebe draft | |||
|
177 | postclose-tip:02de42196ebe draft | |||
|
178 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
176 | $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a` |
|
179 | $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a` | |
177 | pre-close-tip:02de42196ebe draft |
|
180 | pre-close-tip:02de42196ebe draft | |
178 | postclose-tip:02de42196ebe draft |
|
181 | postclose-tip:02de42196ebe draft | |
179 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) |
|
182 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) | |
180 | $ hg -R main bookmark --rev 02de42196ebe book_02de |
|
183 | $ hg -R main bookmark --rev 02de42196ebe book_02de | |
|
184 | pre-close-tip:02de42196ebe draft book_02de | |||
|
185 | postclose-tip:02de42196ebe draft book_02de | |||
|
186 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
181 | $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe` |
|
187 | $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe` | |
182 | pre-close-tip:02de42196ebe draft book_02de |
|
188 | pre-close-tip:02de42196ebe draft book_02de | |
183 | postclose-tip:02de42196ebe draft book_02de |
|
189 | postclose-tip:02de42196ebe draft book_02de | |
184 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) |
|
190 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) | |
185 | $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc |
|
191 | $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc | |
|
192 | pre-close-tip:02de42196ebe draft book_02de | |||
|
193 | postclose-tip:02de42196ebe draft book_02de | |||
|
194 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
186 | $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16` |
|
195 | $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16` | |
187 | pre-close-tip:02de42196ebe draft book_02de |
|
196 | pre-close-tip:02de42196ebe draft book_02de | |
188 | postclose-tip:02de42196ebe draft book_02de |
|
197 | postclose-tip:02de42196ebe draft book_02de | |
189 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) |
|
198 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) | |
190 | $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd |
|
199 | $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd | |
|
200 | pre-close-tip:02de42196ebe draft book_02de | |||
|
201 | postclose-tip:02de42196ebe draft book_02de | |||
|
202 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
191 | $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8` |
|
203 | $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8` | |
192 | pre-close-tip:02de42196ebe draft book_02de |
|
204 | pre-close-tip:02de42196ebe draft book_02de | |
193 | postclose-tip:02de42196ebe draft book_02de |
|
205 | postclose-tip:02de42196ebe draft book_02de | |
194 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) |
|
206 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) | |
195 | $ hg -R main bookmark --rev 32af7686d403 book_32af |
|
207 | $ hg -R main bookmark --rev 32af7686d403 book_32af | |
|
208 | pre-close-tip:02de42196ebe draft book_02de | |||
|
209 | postclose-tip:02de42196ebe draft book_02de | |||
|
210 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
196 | $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403` |
|
211 | $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403` | |
197 | pre-close-tip:02de42196ebe draft book_02de |
|
212 | pre-close-tip:02de42196ebe draft book_02de | |
198 | postclose-tip:02de42196ebe draft book_02de |
|
213 | postclose-tip:02de42196ebe draft book_02de | |
199 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) |
|
214 | txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob) | |
200 |
|
215 | |||
201 | $ hg -R other bookmark --rev cd010b8cd998 book_eea1 |
|
216 | $ hg -R other bookmark --rev cd010b8cd998 book_eea1 | |
|
217 | pre-close-tip:24b6387c8c8c public | |||
|
218 | postclose-tip:24b6387c8c8c public | |||
|
219 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
202 | $ hg -R other bookmark --rev cd010b8cd998 book_02de |
|
220 | $ hg -R other bookmark --rev cd010b8cd998 book_02de | |
|
221 | pre-close-tip:24b6387c8c8c public | |||
|
222 | postclose-tip:24b6387c8c8c public | |||
|
223 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
203 | $ hg -R other bookmark --rev cd010b8cd998 book_42cc |
|
224 | $ hg -R other bookmark --rev cd010b8cd998 book_42cc | |
|
225 | pre-close-tip:24b6387c8c8c public | |||
|
226 | postclose-tip:24b6387c8c8c public | |||
|
227 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
204 | $ hg -R other bookmark --rev cd010b8cd998 book_5fdd |
|
228 | $ hg -R other bookmark --rev cd010b8cd998 book_5fdd | |
|
229 | pre-close-tip:24b6387c8c8c public | |||
|
230 | postclose-tip:24b6387c8c8c public | |||
|
231 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
205 | $ hg -R other bookmark --rev cd010b8cd998 book_32af |
|
232 | $ hg -R other bookmark --rev cd010b8cd998 book_32af | |
|
233 | pre-close-tip:24b6387c8c8c public | |||
|
234 | postclose-tip:24b6387c8c8c public | |||
|
235 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
206 |
|
236 | |||
207 | $ hg -R main phase --public eea13746799a |
|
237 | $ hg -R main phase --public eea13746799a | |
208 | pre-close-tip:02de42196ebe draft book_02de |
|
238 | pre-close-tip:02de42196ebe draft book_02de |
@@ -247,6 +247,9 b' listkeys hook' | |||||
247 |
|
247 | |||
248 | $ echo "listkeys = printenv.py listkeys" >> .hg/hgrc |
|
248 | $ echo "listkeys = printenv.py listkeys" >> .hg/hgrc | |
249 | $ hg bookmark -r null bar |
|
249 | $ hg bookmark -r null bar | |
|
250 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
|
251 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
|
252 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
250 | $ cd ../b |
|
253 | $ cd ../b | |
251 | $ hg pull -B bar ../a |
|
254 | $ hg pull -B bar ../a | |
252 | pulling from ../a |
|
255 | pulling from ../a | |
@@ -279,6 +282,9 b' test that prelistkeys can prevent listin' | |||||
279 |
|
282 | |||
280 | $ echo "prelistkeys = printenv.py prelistkeys.forbid 1" >> .hg/hgrc |
|
283 | $ echo "prelistkeys = printenv.py prelistkeys.forbid 1" >> .hg/hgrc | |
281 | $ hg bookmark -r null quux |
|
284 | $ hg bookmark -r null quux | |
|
285 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
|
286 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
|
287 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |||
282 | $ cd ../b |
|
288 | $ cd ../b | |
283 | $ hg pull -B quux ../a |
|
289 | $ hg pull -B quux ../a | |
284 | pulling from ../a |
|
290 | pulling from ../a |
@@ -74,16 +74,16 b' working dir unaffected by rollback: do n' | |||||
74 | $ hg bookmark foo |
|
74 | $ hg bookmark foo | |
75 | $ hg commit -m'modify a again' |
|
75 | $ hg commit -m'modify a again' | |
76 | $ echo b > b |
|
76 | $ echo b > b | |
|
77 | $ hg bookmark bar -r default #making bar active, before the transaction | |||
77 | $ hg commit -Am'add b' |
|
78 | $ hg commit -Am'add b' | |
78 | adding b |
|
79 | adding b | |
79 | $ hg log --template '{rev} {branch} {desc|firstline}\n' |
|
80 | $ hg log --template '{rev} {branch} {desc|firstline}\n' | |
80 | 2 test add b |
|
81 | 2 test add b | |
81 | 1 test modify a again |
|
82 | 1 test modify a again | |
82 | 0 default add a again |
|
83 | 0 default add a again | |
83 |
$ hg update |
|
84 | $ hg update bar | |
84 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
85 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
85 |
( |
|
86 | (activating bookmark bar) | |
86 | $ hg bookmark bar |
|
|||
87 | $ cat .hg/undo.branch ; echo |
|
87 | $ cat .hg/undo.branch ; echo | |
88 | test |
|
88 | test | |
89 | $ hg rollback -f |
|
89 | $ hg rollback -f | |
@@ -94,7 +94,7 b' working dir unaffected by rollback: do n' | |||||
94 | default |
|
94 | default | |
95 | $ cat .hg/bookmarks.current ; echo |
|
95 | $ cat .hg/bookmarks.current ; echo | |
96 | bar |
|
96 | bar | |
97 | $ hg bookmark --delete foo |
|
97 | $ hg bookmark --delete foo bar | |
98 |
|
98 | |||
99 | rollback by pretxncommit saves commit message (issue1635) |
|
99 | rollback by pretxncommit saves commit message (issue1635) | |
100 |
|
100 |
General Comments 0
You need to be logged in to leave comments.
Login now