##// END OF EJS Templates
localrepo: make journal.dirstate contain in-memory changes before transaction...
FUJIWARA Katsunori -
r25878:800e090e stable
parent child Browse files
Show More
@@ -968,6 +968,9 b' class localrepository(object):'
968 _("abandoned transaction found"),
968 _("abandoned transaction found"),
969 hint=_("run 'hg recover' to clean up transaction"))
969 hint=_("run 'hg recover' to clean up transaction"))
970
970
971 # make journal.dirstate contain in-memory changes at this point
972 self.dirstate.write()
973
971 idbase = "%.40f#%f" % (random.random(), time.time())
974 idbase = "%.40f#%f" % (random.random(), time.time())
972 txnid = 'TXN:' + util.sha1(idbase).hexdigest()
975 txnid = 'TXN:' + util.sha1(idbase).hexdigest()
973 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid)
976 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid)
@@ -130,6 +130,34 b' backout of backout is as if nothing happ'
130 update: (current)
130 update: (current)
131 phases: 4 draft
131 phases: 4 draft
132
132
133 Test that 'hg rollback' restores dirstate just before opening
134 transaction: in-memory dirstate changes should be written into
135 '.hg/journal.dirstate' as expected.
136
137 $ echo 'removed soon' > b
138 $ hg commit -A -d '4 0' -m 'prepare for subsequent removing'
139 adding b
140 $ echo 'newly added' > c
141 $ hg add c
142 $ hg remove b
143 $ hg commit -d '5 0' -m 'prepare for subsequent backout'
144 $ touch -t 200001010000 c
145 $ hg status -A
146 C c
147 $ hg debugstate --nodates
148 n 644 12 set c
149 $ hg backout -d '6 0' -m 'to be rollback-ed soon' -r .
150 adding b
151 removing c
152 changeset 6:4bfec048029d backs out changeset 5:fac0b729a654
153 $ hg rollback -q
154 $ hg status -A
155 A b
156 R c
157 $ hg debugstate --nodates
158 a 0 -1 unset b
159 r 0 0 set c
160
133 across branch
161 across branch
134
162
135 $ cd ..
163 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now