blob: e286f374b914861cda81db8b656a704f5c750a3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/bash
# Copyright (c) 2006-2007 Mauro Carvalho Chehab (mchehab@infradead.org)
# This code is placed under the terms of the GNU General Public License v2
#
#This script is capable to mass import patches from a mercurial tree
#
if [ "$1" == "" ]; then
echo "Usage: $0 <url>"
exit
fi
TREE="`echo $1|perl -ne 's|[/]$||; s|^.*[/]||; print $_;'`"
if [[ "`echo $1|grep ^http://`" != "" ]]; then
SITE="`echo $1|perl -ne 's|[/]$||; print $_;'`"
echo Pushing from remote site $SITE, tree: $TREE
else
DIR=$1
echo "Pushing from local directory $DIR, tree=$TREE"
fi
if [ "$TMP" == "" ]; then
TMP=/tmp
fi
TMP=$TMP/newpatches
if [ ! -d $TMP ]; then
mkdir $TMP
else
rm $TMP/*
fi
if [ "$DIR" != "" ]; then
CS="`hg outgoing -R $DIR .|grep 'changeset:'|cut -f2 -d:`"
else
CS="`hg incoming $SITE |grep 'changeset:'|cut -f3 -d:`"
fi
NUM="`echo $CS|wc -w`"
echo Number of patches: $NUM
j=1
for i in $CS; do
name=$TMP/hg_${TREE}_$(printf %0${#NUM}d ${j}).patch
echo $name with cs=$i
if [ "$DIR" != "" ]; then
hg export -R $DIR $i >$name
else
wget -q -O $name "$SITE?cmd=changeset;node=$i;style=raw"
fi
j=$((j+1))
done
echo "Diffstat of the imported series:"
diffstat -w 72 -p1 $TMP/hg_${TREE}_*.patch
# To cherry pick all files, you can do something like:
#for i in $TMP/newpatches/*; do
# hg import $i;
#done
|