Mercurial > hg
view hgext/largefiles/__init__.py @ 15183:59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
You can get into trouble if you commit, update back to an older
changeset, and then rollback. The update removes your valuable changes
from the working dir, then rollback removes them history. Oops: you've
just irretrievably lost data running nothing but core Mercurial
commands. (More subtly: rollback from a shared clone that was already
at an older changeset -- no update required, just rollback from the
wrong directory.)
The fix assumes that only "commit" transactions have irreplaceable
data, and allows rolling back non-commit transactions as always. But
when rolling back a commit, check that the working dir is checked out
to tip, i.e. the changeset we're about to destroy. If not, abort. You
can get back the old (dangerous) behaviour with --force.
author | Greg Ward <greg@gerg.ca> |
---|---|
date | Fri, 30 Sep 2011 21:58:54 -0400 |
parents | cfccd3bee7b3 |
children | 697289c5d415 |
line wrap: on
line source
# Copyright 2009-2010 Gregory P. Ward # Copyright 2009-2010 Intelerad Medical Systems Incorporated # Copyright 2010-2011 Fog Creek Software # Copyright 2010-2011 Unity Technologies # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. '''track large binary files Large binary files tend to be not very compressible, not very "diffable", and not at all mergeable. Such files are not handled well by Mercurial\'s storage format (revlog), which is based on compressed binary deltas. largefiles solves this problem by adding a centralized client-server layer on top of Mercurial: largefiles live in a *central store* out on the network somewhere, and you only fetch the ones that you need when you need them. largefiles works by maintaining a *standin* in .hglf/ for each largefile. The standins are small (41 bytes: an SHA-1 hash plus newline) and are tracked by Mercurial. Largefile revisions are identified by the SHA-1 hash of their contents, which is written to the standin. largefiles uses that revision ID to get/put largefile revisions from/to the central store. A complete tutorial for using lfiles is included in ``usage.txt`` in the lfiles source distribution. See https://developers.kilnhg.com/Repo/Kiln/largefiles/largefiles/File/usage.txt ''' from mercurial import commands import lfcommands import reposetup import uisetup reposetup = reposetup.reposetup uisetup = uisetup.uisetup commands.norepo += " lfconvert" cmdtable = lfcommands.cmdtable