forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPU
More file actions
executable file
·90 lines (85 loc) · 1.49 KB
/
PU
File metadata and controls
executable file
·90 lines (85 loc) · 1.49 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
#
# Rebuild "pu" from topic branches.
#
git update-index --refresh || exit
case "$(git diff-index --name-status HEAD)" in
'') ;;
*) echo 2>&1 "Local modifications exist."
exit 1;;
esac
case "$1" in
--continue)
shift
;;
*)
git checkout pu &&
git reset --hard master || exit
esac
ORIG_HEAD=`git rev-parse ORIG_HEAD` || exit
LF='
'
case "$#" in
0)
# interactive ;-)
shift
HH=`cd .git/refs/heads && find -type f |
sed -e 's/^\.\///' \
-e '/^naster$/d' -e '/^master$/d' -e '/^maint$/d' -e '/^pu$/d'`
while test "$HH"
do
I=0
echo "0: done"
NHH=
for H in $HH
do
HSHA1=`git rev-parse --verify $H` || continue
MB=`git show-branch --merge-base pu $HSHA1`
case "$LF$MB$LF" in
*"$LF$HSHA1$LF"*) continue ;; # already merged.
esac
I=$(($I+1))
echo -n "$I: "
git show-branch $H
NHH="${NHH}$H "
done
case "$I" in
0)
break ;;
esac
HH=$NHH
echo -n "Merge which ones (0 to finish)? "
read ans
case "$ans" in
'' | 0)
break ;;
esac
I=0
UNUSE= USE= USED=
for H in $HH
do
I=$(($I+1))
case " $ans " in
*' '$I' '*)
USE="$USE$H "
USED="$USED,$H"
;;
*)
UNUSE="$UNUSE$H "
;;
esac
done
USED=`expr "$USED" : ',\(.*\)'`
git pull -n . $USE || exit
# git merge -n "Merge $USED" pu $USE || exit
HH=$UNUSE
done
exit
;;
esac
for H
do
# (IFS=",$IFS"; git merge -n "Merge $H" pu $H) || exit
(IFS=",$IFS"; git pull -n . $H) || exit
done
(IFS=",$IFS"; git show-branch master $* pu `git rev-parse --short $ORIG_HEAD`)