transaction: actually delete file created during the transaction on rollback
Transaction currently has two modes:
- one where file created during the transaction are deleted on rollback,
- one where file created during the transaction are truncated to 0 on rollback.
Before this change, `hg rollback` and `hg recover` are using the "delete" mode
and transaction abort is using the "truncate" option. This difference is never
really explained. A long time ago, there was two code paths, with this
divergence existing for unclear reasons. When the two code paths got merged into
a single one, a boolean argument have been added to preserve this divergence,
mostly probably as a cargo cult.
The divergence is weird and induce bad surprises, and the truncate behavior is a
bit odds, introducing other bad surprises (e.g.
08ecbdba186f)
So solve this, we stop using the "truncate" behavior and unify on the "delete"
behavior. Despite being currently more "common", the truncate behavior seems
less natural, resulting in the transaction leaving empty file around.
This is landed on default, early in the cycle, to help us catch problems that
could emerge.
# stack.py - Mercurial functions for stack definition
#
# Copyright Olivia Mackall <olivia@selenic.com> and other
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
def getstack(repo, rev=None):
"""return a sorted smartrev of the stack containing either rev if it is
not None or the current working directory parent.
The stack will always contain all drafts changesets which are ancestors to
the revision and are not merges.
"""
if rev is None:
rev = b'.'
revspec = b'only(%s) and not public() and not ::merge()'
revisions = repo.revs(revspec, rev)
revisions.sort()
return revisions