def _aborttransaction(repo, tr):
    """Abort current transaction for shelve/unshelve, but keep dirstate
    """
    dirstatebackupname = b'dirstate.shelve'
    repo.dirstate.savebackup(tr, dirstatebackupname)
    tr.abort()
    repo.dirstate.restorebackup(None, dirstatebackupname)
