Project Home

histpush.py

Abstract

A Mercurial extension that allows you to locally track which revisions of a repository have been pushed to a remote repository.

Table of Contents

Description

A Mercurial extension that allows you to locally track which revisions of a repository have been pushed to a remote repository.

When you use Mercurial in a completely disconnected fashion, at some point you may want to be able to find out if you have new revisions that need to be pushed out to a central repository, without having to connect it (this is the key: you can be off the network and it works). This command allows you to do that. It relies on an the installation of an 'outgoing' hook which stamps all revisions everytime you push. The record is kept under the '<root>/.hg/pushed.history' file

Usage

To list the revisions that have never been pushed, just run the command:

hg histpush

To force marking all the revisions in a repository as having been pushed, run with the --mark option:

hg histpush --mark

You should do this once on an existing repository after installing the histpush extension, to initialize the history file.

Installation

Add the following configuration variables to your hgrc file (or the repository's .hg/hgrc):

[extensions]
histpush =

[hooks]
outgoing = python:histpush.update

Notes

I use this in the context of working from my laptop: all my work files are being 'backed up' to a server when I push my changes. When I walk around town with my laptop with unsaved work I get a little nervous about losing it... there is nothing that angers me more than losing data. So... I want to be able to know if I need to push changes to the main copies on my server.... if I don't, I can safely be careless about the laptop: you can steal it and I don't really care, I've got all the data (I care a lot more about wasted time than about the laptop hardware). Weird, but... true story.

Alternative

An alternative is that you could just have a setup like:

my/project/upstream
my/project/dev

where upstream is a pristine clone of the upstream repo and dev is hg clone upstream dev. Then a simple hg out in dev will tell you what would get pushed. This also makes it easy to clone another copy for a separate line of changes (-- P. Arrenbrecht).

Please Donate!

Important

This computer program or library is provided for free. I am aware that some of the programs that I provide for free allow people to get their work done faster or better, save them time and money. If you are using this program for benefit, especially if you are using it within a commercial environment and it saves you time or work, please consider making a donation by sending me a book from my Amazon Wishlist or by a direct donation to my company's PayPal account by clicking on the link below.

Download

Download program here.