##// END OF EJS Templates
localrepo: enforce a clean dirstate when the transaction open...
marmoute -
r50977:a6692609 default
parent child Browse files
Show More
@@ -2375,6 +2375,21 b' class localrepository:'
2375 hint=_(b"run 'hg recover' to clean up transaction"),
2375 hint=_(b"run 'hg recover' to clean up transaction"),
2376 )
2376 )
2377
2377
2378 # At that point your dirstate should be clean:
2379 #
2380 # - If you don't have the wlock, why would you still have a dirty
2381 # dirstate ?
2382 #
2383 # - If you hold the wlock, you should not be opening a transaction in
2384 # the middle of a `distate.changing_*` block. The transaction needs to
2385 # be open before that and wrap the change-context.
2386 #
2387 # - If you are not within a `dirstate.changing_*` context, why is our
2388 # dirstate dirty?
2389 if self.dirstate._dirty:
2390 m = "cannot open a transaction with a dirty dirstate"
2391 raise error.ProgrammingError(m)
2392
2378 idbase = b"%.40f#%f" % (random.random(), time.time())
2393 idbase = b"%.40f#%f" % (random.random(), time.time())
2379 ha = hex(hashutil.sha1(idbase).digest())
2394 ha = hex(hashutil.sha1(idbase).digest())
2380 txnid = b'TXN:' + ha
2395 txnid = b'TXN:' + ha
General Comments 0
You need to be logged in to leave comments. Login now