Outils pour utilisateurs

Outils du site


tips_informatiques:hg:tips_informatiques

Script pour tester les changements en attente dans plusieurs projets

Problème:

Comment tester facilement si des changements sont en attente (status, outgoing, incoming) dans plusieurs projets ?

Script:

#!/bin/bash
# script to test if changes are pending in some Mercurial repositories
# author: Nicolas Rod, 13.08.2010
 
workspace=/home/rodn/workspace/
repositories="cakephp_alaxos blaxos demo_alaxos tandem"
unchanged_text="aucun changement"
 
#clear the screen for better display
clear
 
for repository in $repositories
do
	echo "----------------------"
	echo "|| $repository ||"
	echo "----------------------"
 
	cd "$workspace$repository"
 
	echo "---------status"
	st=$(hg status)
	st_length=${#st}
	if (($st_length > 0))
	then
		echo -e "\033[1;32m$st\033[0m"
	fi
 
	echo "---------incoming"
	in=$(hg incoming)
	if ! grep -q "$unchanged_text" <<<$in;
	then
		echo -e "\033[1;32m$in\033[0m"
	fi
 
	echo "---------outgoing"
	out=$(hg outgoing)
	if ! grep -q "$unchanged_text" <<<$out;
	then
		echo -e "\033[1;32m$out\033[0m"
	fi
 
	echo
done

Appliquer un commit à un autre projet (patch)

Problème:

Dans le cas de deux projets distincts A et B ayant un même projet comme ancêtre, il est possible d'appliquer des commits du projet A au projet B, pour par exemple corriger un bug existant dans les deux projets A et B

Commandes:

1) procéder au commit dans le projet A

2) exporter le changeset du commit:

hg export -o changeset-54.patch 54:e3745da77977

3) dans le projet B, importer le changeset:

hg import changeset-54.patch --no-commit

Note: l'ajout de –no-commit permet de vérifier les changements appliqués avant de les commiter dans le projet B

Logs au format CSV

Problème:

Comment obtenir les logs d'un projet dans un format que l'on peut parser facilement

Commandes:

$ hg log --template "{rev}\t{node}\t{date|isodate}\t{author}\t{desc}\n"
 
61	6aab1393fc3dd13c429121a92979a4a9fc797f70	2012-07-13 18:17 +0200	Nicolas Rod <nico@alaxos.com>	ACL plugin update
60	806ca0813e7b5fe3685452386195c9fbc6f5f065	2012-07-13 18:13 +0200	Nicolas Rod <nico@alaxos.com>	Alaxos plugin update
59	edb937096cddb2ee947e1dd15cef727e3798db71	2012-07-02 13:04 +0200	Nicolas Rod <nico@alaxos.com>	Alaxos plugin update
tips_informatiques/hg/tips_informatiques.txt · Dernière modification: 2015/10/30 13:14 par nico