##// END OF EJS Templates
rollback: add dry-run argument, emit transaction description
Steve Borho -
r10882:f0bfe42c default
parent child Browse files
Show More
@@ -241,10 +241,10 b' def reposetup(ui, repo):'
241 file.close()
241 file.close()
242 return mark
242 return mark
243
243
244 def rollback(self):
244 def rollback(self, *args):
245 if os.path.exists(self.join('undo.bookmarks')):
245 if os.path.exists(self.join('undo.bookmarks')):
246 util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
246 util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
247 return super(bookmark_repo, self).rollback()
247 return super(bookmark_repo, self).rollback(*args)
248
248
249 def lookup(self, key):
249 def lookup(self, key):
250 if key in self._bookmarks:
250 if key in self._bookmarks:
@@ -2854,7 +2854,7 b' def revert(ui, repo, *pats, **opts):'
2854 finally:
2854 finally:
2855 wlock.release()
2855 wlock.release()
2856
2856
2857 def rollback(ui, repo):
2857 def rollback(ui, repo, **opts):
2858 """roll back the last transaction
2858 """roll back the last transaction
2859
2859
2860 This command should be used with care. There is only one level of
2860 This command should be used with care. There is only one level of
@@ -2881,7 +2881,7 b' def rollback(ui, repo):'
2881 repository; for example an in-progress pull from the repository
2881 repository; for example an in-progress pull from the repository
2882 may fail if a rollback is performed.
2882 may fail if a rollback is performed.
2883 """
2883 """
2884 repo.rollback()
2884 repo.rollback(opts.get('dry_run'))
2885
2885
2886 def root(ui, repo):
2886 def root(ui, repo):
2887 """print the root (top) of the current working directory
2887 """print the root (top) of the current working directory
@@ -3821,7 +3821,7 b' table = {'
3821 ('', 'no-backup', None, _('do not save backup copies of files')),
3821 ('', 'no-backup', None, _('do not save backup copies of files')),
3822 ] + walkopts + dryrunopts,
3822 ] + walkopts + dryrunopts,
3823 _('[OPTION]... [-r REV] [NAME]...')),
3823 _('[OPTION]... [-r REV] [NAME]...')),
3824 "rollback": (rollback, []),
3824 "rollback": (rollback, dryrunopts),
3825 "root": (root, []),
3825 "root": (root, []),
3826 "^serve":
3826 "^serve":
3827 (serve,
3827 (serve,
@@ -599,13 +599,25 b' class localrepository(repo.repository):'
599 finally:
599 finally:
600 lock.release()
600 lock.release()
601
601
602 def rollback(self):
602 def rollback(self, dryrun=False):
603 wlock = lock = None
603 wlock = lock = None
604 try:
604 try:
605 wlock = self.wlock()
605 wlock = self.wlock()
606 lock = self.lock()
606 lock = self.lock()
607 if os.path.exists(self.sjoin("undo")):
607 if os.path.exists(self.sjoin("undo")):
608 self.ui.status(_("rolling back last transaction\n"))
608 try:
609 args = self.opener("undo.desc", "r").read().split(",")
610 if len(args) == 3 and self.ui.verbose:
611 desc = _("rolling back %s (%s) to revision %s\n") % (
612 args[1], args[2], args[0])
613 else:
614 desc = _("rolling back %s to revision %s\n") % (
615 args[1], args[0])
616 except (IOError, IndexError):
617 desc = _("rolling back unknown transaction\n")
618 self.ui.status(desc)
619 if dryrun:
620 return
609 transaction.rollback(self.sopener, self.sjoin("undo"),
621 transaction.rollback(self.sopener, self.sjoin("undo"),
610 self.ui.warn)
622 self.ui.warn)
611 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
623 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
@@ -71,7 +71,7 b' adding quux/file.py revisions'
71 files: 3 chunks
71 files: 3 chunks
72 added 3 changesets with 3 changes to 3 files
72 added 3 changesets with 3 changes to 3 files
73 updating the branch cache
73 updating the branch cache
74 rolling back last transaction
74 rolling back push to revision 1
75 0:6675d58eff77
75 0:6675d58eff77
76
76
77 Extension disabled for lack of acl.sources
77 Extension disabled for lack of acl.sources
@@ -143,7 +143,7 b' added 3 changesets with 3 changes to 3 f'
143 calling hook pretxnchangegroup.acl: hgext.acl.hook
143 calling hook pretxnchangegroup.acl: hgext.acl.hook
144 acl: changes have source "push" - skipping
144 acl: changes have source "push" - skipping
145 updating the branch cache
145 updating the branch cache
146 rolling back last transaction
146 rolling back push to revision 1
147 0:6675d58eff77
147 0:6675d58eff77
148
148
149 No [acl.allow]/[acl.deny]
149 No [acl.allow]/[acl.deny]
@@ -221,7 +221,7 b' acl: allowing changeset ef1ea85a6374'
221 acl: allowing changeset f9cafe1212c8
221 acl: allowing changeset f9cafe1212c8
222 acl: allowing changeset 911600dab2ae
222 acl: allowing changeset 911600dab2ae
223 updating the branch cache
223 updating the branch cache
224 rolling back last transaction
224 rolling back push to revision 1
225 0:6675d58eff77
225 0:6675d58eff77
226
226
227 Empty [acl.allow]
227 Empty [acl.allow]
@@ -799,7 +799,7 b' acl: allowing changeset ef1ea85a6374'
799 acl: allowing changeset f9cafe1212c8
799 acl: allowing changeset f9cafe1212c8
800 acl: allowing changeset 911600dab2ae
800 acl: allowing changeset 911600dab2ae
801 updating the branch cache
801 updating the branch cache
802 rolling back last transaction
802 rolling back push to revision 1
803 0:6675d58eff77
803 0:6675d58eff77
804
804
805 wilma can change files with a .txt extension
805 wilma can change files with a .txt extension
@@ -1160,6 +1160,6 b' acl: allowing changeset ef1ea85a6374'
1160 acl: allowing changeset f9cafe1212c8
1160 acl: allowing changeset f9cafe1212c8
1161 acl: allowing changeset 911600dab2ae
1161 acl: allowing changeset 911600dab2ae
1162 updating the branch cache
1162 updating the branch cache
1163 rolling back last transaction
1163 rolling back push to revision 1
1164 0:6675d58eff77
1164 0:6675d58eff77
1165
1165
@@ -62,7 +62,7 b' abort: cannot use --parent on non-merge '
62 # backout with valid parent should be ok
62 # backout with valid parent should be ok
63 removing d
63 removing d
64 changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
64 changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
65 rolling back last transaction
65 rolling back commit to revision 5
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 removing c
67 removing c
68 changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
68 changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
@@ -154,7 +154,7 b' checking manifests'
154 crosschecking files in changesets and manifests
154 crosschecking files in changesets and manifests
155 checking files
155 checking files
156 4 files, 9 changesets, 7 total revisions
156 4 files, 9 changesets, 7 total revisions
157 rolling back last transaction
157 rolling back pull to revision 5
158 % should fail
158 % should fail
159 abort: --base is incompatible with specifying a destination
159 abort: --base is incompatible with specifying a destination
160 abort: repository default-push not found!
160 abort: repository default-push not found!
@@ -187,7 +187,7 b' checking manifests'
187 crosschecking files in changesets and manifests
187 crosschecking files in changesets and manifests
188 checking files
188 checking files
189 4 files, 9 changesets, 7 total revisions
189 4 files, 9 changesets, 7 total revisions
190 rolling back last transaction
190 rolling back unbundle to revision 3
191 % 2
191 % 2
192 2:d62976ca1e50
192 2:d62976ca1e50
193 adding changesets
193 adding changesets
@@ -202,7 +202,7 b' checking manifests'
202 crosschecking files in changesets and manifests
202 crosschecking files in changesets and manifests
203 checking files
203 checking files
204 2 files, 5 changesets, 5 total revisions
204 2 files, 5 changesets, 5 total revisions
205 rolling back last transaction
205 rolling back unbundle to revision 3
206 adding changesets
206 adding changesets
207 adding manifests
207 adding manifests
208 adding file changes
208 adding file changes
@@ -215,7 +215,7 b' checking manifests'
215 crosschecking files in changesets and manifests
215 crosschecking files in changesets and manifests
216 checking files
216 checking files
217 3 files, 7 changesets, 6 total revisions
217 3 files, 7 changesets, 6 total revisions
218 rolling back last transaction
218 rolling back unbundle to revision 3
219 adding changesets
219 adding changesets
220 adding manifests
220 adding manifests
221 adding file changes
221 adding file changes
@@ -37,7 +37,7 b' adding file changes'
37 added 9 changesets with 7 changes to 4 files (+1 heads)
37 added 9 changesets with 7 changes to 4 files (+1 heads)
38 (run 'hg heads' to see heads, 'hg merge' to merge)
38 (run 'hg heads' to see heads, 'hg merge' to merge)
39 ====== Rollback empty
39 ====== Rollback empty
40 rolling back last transaction
40 rolling back pull to revision 0
41 ====== Pull full.hg into empty again (using --cwd)
41 ====== Pull full.hg into empty again (using --cwd)
42 pulling from ../full.hg
42 pulling from ../full.hg
43 requesting all changes
43 requesting all changes
@@ -55,7 +55,7 b' pulling from full.hg'
55 searching for changes
55 searching for changes
56 no changes found
56 no changes found
57 ====== Rollback empty
57 ====== Rollback empty
58 rolling back last transaction
58 rolling back pull to revision 0
59 ====== Pull full.hg into empty again (using -R)
59 ====== Pull full.hg into empty again (using -R)
60 pulling from full.hg
60 pulling from full.hg
61 requesting all changes
61 requesting all changes
@@ -123,7 +123,7 b' adding file changes'
123 added 9 changesets with 7 changes to 4 files (+1 heads)
123 added 9 changesets with 7 changes to 4 files (+1 heads)
124 (run 'hg heads' to see heads, 'hg merge' to merge)
124 (run 'hg heads' to see heads, 'hg merge' to merge)
125 ====== Rollback empty
125 ====== Rollback empty
126 rolling back last transaction
126 rolling back pull to revision 0
127 ====== Log -R bundle:empty+full.hg
127 ====== Log -R bundle:empty+full.hg
128 8 7 6 5 4 3 2 1 0
128 8 7 6 5 4 3 2 1 0
129 ====== Pull full.hg into empty again (using -R; with hook)
129 ====== Pull full.hg into empty again (using -R; with hook)
@@ -45,7 +45,7 b' converting...'
45 2 Initial revision
45 2 Initial revision
46 1 import
46 1 import
47 filtering out empty revision
47 filtering out empty revision
48 rolling back last transaction
48 rolling back commit to revision 1
49 0 ci0
49 0 ci0
50 updating tags
50 updating tags
51 c
51 c
@@ -220,7 +220,7 b' recover:'
220 rename: after, force, include, exclude, dry-run
220 rename: after, force, include, exclude, dry-run
221 resolve: all, list, mark, unmark, no-status, include, exclude
221 resolve: all, list, mark, unmark, no-status, include, exclude
222 revert: all, date, rev, no-backup, include, exclude, dry-run
222 revert: all, date, rev, no-backup, include, exclude, dry-run
223 rollback:
223 rollback: dry-run
224 root:
224 root:
225 showconfig: untrusted
225 showconfig: untrusted
226 tag: force, local, rev, remove, message, date, user
226 tag: force, local, rev, remove, message, date, user
@@ -43,7 +43,7 b" examine changes to 'a'? [Ynsfdaq?]"
43 c
43 c
44 record this change to 'a'? [Ynsfdaq?]
44 record this change to 'a'? [Ynsfdaq?]
45
45
46 rolling back last transaction
46 rolling back commit to revision 1
47 % qrecord
47 % qrecord
48 diff --git a/a b/a
48 diff --git a/a b/a
49 old mode 100644
49 old mode 100644
@@ -101,7 +101,7 b' adding manifests'
101 adding file changes
101 adding file changes
102 added 1 changesets with 1 changes to 1 files
102 added 1 changesets with 1 changes to 1 files
103 (run 'hg update' to get a working copy)
103 (run 'hg update' to get a working copy)
104 rolling back last transaction
104 rolling back pull to revision 4
105 preoutgoing hook: HG_SOURCE=pull
105 preoutgoing hook: HG_SOURCE=pull
106 preoutgoing.forbid hook: HG_SOURCE=pull
106 preoutgoing.forbid hook: HG_SOURCE=pull
107 pulling from ../a
107 pulling from ../a
@@ -182,7 +182,7 b' parent: 0'
182 applying ../patch1
182 applying ../patch1
183 applying ../patch2
183 applying ../patch2
184 applied 1d4bd90af0e4
184 applied 1d4bd90af0e4
185 rolling back last transaction
185 rolling back commit to revision 2
186 parent: 1
186 parent: 1
187 % hg import in a subdirectory
187 % hg import in a subdirectory
188 requesting all changes
188 requesting all changes
@@ -198,7 +198,7 b' diff -r ef63ca68695b c'
198 +do not process $Id:
198 +do not process $Id:
199 +xxx $
199 +xxx $
200 % rollback
200 % rollback
201 rolling back last transaction
201 rolling back commit to revision 2
202 % status
202 % status
203 A c
203 A c
204 % update -C
204 % update -C
@@ -266,7 +266,7 b' committed changeset 3:d14c712653769de926'
266 % status
266 % status
267 ? c
267 ? c
268 % rollback
268 % rollback
269 rolling back last transaction
269 rolling back commit to revision 3
270 % status
270 % status
271 R a
271 R a
272 ? c
272 ? c
@@ -308,7 +308,7 b' xxx $'
308 ignore $Id$
308 ignore $Id$
309
309
310 % rollback
310 % rollback
311 rolling back last transaction
311 rolling back commit to revision 3
312 % clean update
312 % clean update
313 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 % kwexpand/kwshrink on selected files
314 % kwexpand/kwshrink on selected files
@@ -62,7 +62,7 b' foo'
62 default
62 default
63 bar
63 bar
64 % test for invalid branch cache
64 % test for invalid branch cache
65 rolling back last transaction
65 rolling back commit to revision 5
66 changeset: 4:4909a3732169
66 changeset: 4:4909a3732169
67 branch: foo
67 branch: foo
68 tag: tip
68 tag: tip
@@ -95,10 +95,10 b' diff -r cb9a9f314b8b -r 0647d048b600 a'
95 +a
95 +a
96 (run 'hg update' to get a working copy)
96 (run 'hg update' to get a working copy)
97 % fail for config file is missing
97 % fail for config file is missing
98 rolling back last transaction
98 rolling back pull to revision 1
99 pull failed
99 pull failed
100 % pull
100 % pull
101 rolling back last transaction
101 rolling back pull to revision 1
102 pulling from ../a
102 pulling from ../a
103 searching for changes
103 searching for changes
104 adding changesets
104 adding changesets
@@ -129,7 +129,7 b' diff -r cb9a9f314b8b -r 0647d048b600 a'
129 +a
129 +a
130 (run 'hg update' to get a working copy)
130 (run 'hg update' to get a working copy)
131 % pull
131 % pull
132 rolling back last transaction
132 rolling back pull to revision 1
133 pulling from ../a
133 pulling from ../a
134 searching for changes
134 searching for changes
135 adding changesets
135 adding changesets
@@ -19,7 +19,7 b' summary: add foo'
19 abort: unknown revision 'missing'!
19 abort: unknown revision 'missing'!
20 % pull multiple revisions with update
20 % pull multiple revisions with update
21 0:bbd179dfa0a7
21 0:bbd179dfa0a7
22 rolling back last transaction
22 rolling back pull to revision 0
23 % pull -r 0
23 % pull -r 0
24 changeset: 0:bbd179dfa0a7
24 changeset: 0:bbd179dfa0a7
25 tag: tip
25 tag: tip
@@ -25,7 +25,7 b' remote: adding file changes'
25 remote: added 1 changesets with 1 changes to 1 files
25 remote: added 1 changesets with 1 changes to 1 files
26 % serve errors
26 % serve errors
27 changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http
27 changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http
28 rolling back last transaction
28 rolling back serve to revision 1
29 % expect authorization error: all users denied
29 % expect authorization error: all users denied
30 abort: authorization failed
30 abort: authorization failed
31 pushing to http://localhost:$HGPORT/
31 pushing to http://localhost:$HGPORT/
@@ -34,7 +34,7 b' 2 files updated, 0 files merged, 0 files'
34 (branch merge, don't forget to commit)
34 (branch merge, don't forget to commit)
35 % commit issue 1476
35 % commit issue 1476
36 copies: c2 (c1)
36 copies: c2 (c1)
37 rolling back last transaction
37 rolling back commit to revision 3
38 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
38 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
39 % merge heads again
39 % merge heads again
40 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -9,7 +9,7 b' user: test'
9 date: Mon Jan 12 13:46:40 1970 +0000
9 date: Mon Jan 12 13:46:40 1970 +0000
10 summary: test
10 summary: test
11
11
12 rolling back last transaction
12 rolling back commit to revision 0
13 checking changesets
13 checking changesets
14 checking manifests
14 checking manifests
15 crosschecking files in changesets and manifests
15 crosschecking files in changesets and manifests
@@ -18,14 +18,14 b' 0 files, 0 changesets, 0 total revisions'
18 A a
18 A a
19 % Test issue 902
19 % Test issue 902
20 marked working directory as branch test
20 marked working directory as branch test
21 rolling back last transaction
21 rolling back commit to revision 0
22 default
22 default
23 % Test issue 1635 (commit message saved)
23 % Test issue 1635 (commit message saved)
24 .hg/last-message.txt:
24 .hg/last-message.txt:
25 test2
25 test2
26 % Test rollback of hg before issue 902 was fixed
26 % Test rollback of hg before issue 902 was fixed
27 marked working directory as branch test
27 marked working directory as branch test
28 rolling back last transaction
28 rolling back commit to revision 0
29 Named branch could not be reset, current branch still is: test
29 Named branch could not be reset, current branch still is: test
30 test
30 test
31 % rollback by pretxncommit saves commit message (issue 1635)
31 % rollback by pretxncommit saves commit message (issue 1635)
@@ -111,7 +111,7 b' date: Thu Jan 01 00:00:00 1970 +0'
111 summary: Removed tag bar
111 summary: Removed tag bar
112
112
113 % rollback undoes tag operation
113 % rollback undoes tag operation
114 rolling back last transaction
114 rolling back commit to revision 5
115 tip 4:0c192d7d5e6b
115 tip 4:0c192d7d5e6b
116 bar 1:78391a272241
116 bar 1:78391a272241
117 tip 4:0c192d7d5e6b
117 tip 4:0c192d7d5e6b
@@ -75,7 +75,7 b' summary: add a'
75
75
76
76
77 % rolling back
77 % rolling back
78 rolling back last transaction
78 rolling back push to revision 2
79 % incoming
79 % incoming
80 2:faba9097cad4
80 2:faba9097cad4
81 % pull
81 % pull
@@ -104,7 +104,7 b' summary: add a'
104 % no new revs, no update
104 % no new revs, no update
105 0:1f0dee641bb7
105 0:1f0dee641bb7
106 % rollback
106 % rollback
107 rolling back last transaction
107 rolling back pull to revision 2
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 0:1f0dee641bb7
109 0:1f0dee641bb7
110 % pull -u takes us back to branch foo
110 % pull -u takes us back to branch foo
@@ -116,7 +116,7 b' date: Thu Jan 01 00:00:00 1970 +0'
116 summary: new head of branch foo
116 summary: new head of branch foo
117
117
118 % rollback
118 % rollback
119 rolling back last transaction
119 rolling back pull to revision 2
120 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
121 % parents
121 % parents
122 0:1f0dee641bb7
122 0:1f0dee641bb7
General Comments 0
You need to be logged in to leave comments. Login now