[PATCH] subrepo: do not push "clean" subrepos when the parent repo is pushed

Kevin Bullock kbullock+mercurial at ringworld.org
Thu Feb 14 10:12:36 CST 2013


On 14 Feb 2013, at 2:39 AM, Angel Ezquerra wrote:

> On Thu, Feb 14, 2013 at 2:31 AM, Matt Mackall <mpm at selenic.com> wrote:
>> On Thu, 2013-02-14 at 01:06 +0100, Angel Ezquerra wrote:
>>> # HG changeset patch
>>> # User Angel Ezquerra <angel.ezquerra at gmail.com>
>>> # Date 1360795816 -3600
>>> # Node ID 26276460d54aecdeb107c82c4e3f2ca7c0c6a8b3
>>> # Parent  55b9b294b7544a6a144f627f71f4b770907d5a98
>>> subrepo: do not push "clean" subrepos when the parent repo is pushed
>>> 
>>> A clean subrepo is defined as one that has not had its dirstate, bookmarks or
>>> phases modified.
>>> 
>>> This patch works by adding a "clean" method to subrepos. In the case of
>>> mercurial subrepos, this method calculates a "stamp" (i.e. a set of file hashes)
>>> of the repository state at the time of push with a similar "stamp" that was
>>> stored on a file when the subrepo was cloned or pushed to a given remote target.
>>> If the stamps match the subrepo has no changes that must be pushed to the target
>>> repository and thus the push can be skipped.
>>> 
>>> Note that we calculate the stamp file by calculating hashes for several key
>>> repository files, such as the dirstate, the bookmarks file and the phaseroots
>>> file. This means that our "clean" detection is not perfect, in the sense that
>>> if the working directory has been updated to a different revision we will
>>> assume that the subrepo is not clean. However, if we update to another revision
>>> and back to the original revision the clean() method will correctly detec the
>>> subrepo as being clean.
> 
>> Why is the dirstate interesting? I would posit that we're only
>> interested in things that we'd push or pull. Dirstate being modified
>> should not force us to push.
> 
> I think I may have misunderstood you when we discussed this during the
> sprint. I thought you mentioned that we should check the direstate,
> the bookmarks and the phaseroots.

I remember asking the same question during the sprint -- we'll need to check the dirstate later to figure out whether we can move a subrepo aside on -update-. It doesn't apply to clean-ness for the purposes of push and pull.

> I don't know the mercurial store format well enough to tell which
> files we need to hash. Would hashing "store/00changelog.i" and
> "store/00manifest.i" be enough? An alternative would be to hash the
> list of repository heads and consider the repo unclean if that
> changed?

I would think that the changelog, bookmarks, and phaseroots would be enough.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list