tests/test-mq-header-from
author Edouard Gomez <ed.gomez@free.fr>
Sun, 04 Jan 2009 02:36:48 +0100
changeset 7583 77fec2d270ae
parent 5822 38b592536a58
child 7627 fb32ae9c76e7
permissions -rwxr-xr-x
convert/gnuarch: parse continuation-of revisions in gnuarch source In GNU Arch, continuation-of was often used for: - tagging revisions - continue working on a project in a new archive, because arch was scaling poorly in revision numbers (cat-logs were slow to be parsed and scanned through) - very similar to the previous point, fork his own branch of a project. Parsing this header information will allow to 'follow' new history because it often hints at older/forked/personal revision trees. This patch however just implements the parsing of the continuation-of header. A followup patch will implement the proper use of this new information.

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH
echo "[diff]" >> $HGRCPATH
echo "nodates=true" >> $HGRCPATH


catlog() {
    cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /"
    hg log --template "{rev}: {desc} - {author}\n"
}


echo ==== init
hg init a
cd a
hg qinit


echo ==== qnew -U
hg qnew -U 1.patch
catlog 1

echo ==== qref
echo "1" >1
hg add
hg qref
catlog 1

echo ==== qref -u
hg qref -u mary
catlog 1

echo ==== qnew
hg qnew 2.patch
echo "2" >2
hg add
hg qref
catlog 2

echo ==== qref -u
hg qref -u jane
catlog 2


echo ==== qnew -U -m
hg qnew -U -m "Three" 3.patch
catlog 3

echo ==== qref
echo "3" >3
hg add
hg qref
catlog 3

echo ==== qref -m
hg qref -m "Drei"
catlog 3

echo ==== qref -u
hg qref -u mary
catlog 3

echo ==== qref -u -m
hg qref -u maria -m "Three (again)"
catlog 3

echo ==== qnew -m
hg qnew -m "Four" 4.patch
echo "4" >4
hg add
hg qref
catlog 4

echo ==== qref -u
hg qref -u jane
catlog 4


echo ==== qnew with HG header
hg qnew 5.patch
hg qpop
echo "# HG changeset patch" >>.hg/patches/5.patch
echo "# User johndoe" >>.hg/patches/5.patch
hg qpush 2>&1 | grep 'Now at'
catlog 5

echo ==== hg qref
echo "5" >5
hg add
hg qref
catlog 5

echo ==== hg qref -U
hg qref -U
catlog 5

echo ==== hg qref -u
hg qref -u johndeere
catlog 5


echo ==== "qpop -a / qpush -a"
hg qpop -a
hg qpush -a
hg log --template "{rev}: {desc} - {author}\n"