[PATCH STABLE] strip: do not overwrite existing backup bundles

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Dec 28 11:01:19 CST 2011


On Wed, Dec 28, 2011 at 03:40:34PM +0000, Frank Kingswood wrote:
> On 28/12/11 02:28, Pierre-Yves David wrote:
> >
> >On 28 déc. 2011, at 03:10, Laurens Holst wrote:
> >
> >># HG changeset patch
> >># User Laurens Holst<laurens.hg at grauw.nl>
> >># Date 1325036331 -3600
> >># Node ID 9ef0648c6e5433d1d70642693ff7dba8302328fa
> >># Parent  3317d5c34f384c6d1d8440e19980a2261beecc7a
> >>strip: do not overwrite existing backup bundles
> >>
> >>I ran into a data loss issue where a strip‚s backup overwrote a previous backup
> >>which had more descendants. This happens because the backup file name composed
> >>of just the hash of the first stripped changeset. The issue is fixed by
> >>suffixing the backup file with a - and a number as needed.
> >
> 
> >I would add a bound to the amount of filename we try.
> >
> >filename = "%s-%s.hg" % (short(node), suffix)
> >for i in itertools.count(1, 256):
> 
> That is not how itertools.count works.
> This sets the increment to 256, not a limit.

I mean xrange here of course.

-- 
Pierre-Yves


More information about the Mercurial-devel mailing list