chiark
/
gitweb
/
~ian
/
topgit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b12909b
)
tg import -s: Import single commit using well-defined name
author
Petr Baudis
<pasky@suse.cz>
Thu, 25 Sep 2008 18:06:57 +0000
(20:06 +0200)
committer
Petr Baudis
<pasky@suse.cz>
Thu, 25 Sep 2008 18:06:57 +0000
(20:06 +0200)
README
patch
|
blob
|
history
tg-import.sh
patch
|
blob
|
history
diff --git
a/README
b/README
index 8a68a652bd493c8397410362d98bcf58750dcb12..8129f9190e68b3101cd234f94db5aac2170f2327 100644
(file)
--- a/
README
+++ b/
README
@@
-423,6
+423,10
@@
tg import
and prefixed by t/ by default; use '-p PREFIX' to specify
an alternative prefix (even an empty one).
and prefixed by t/ by default; use '-p PREFIX' to specify
an alternative prefix (even an empty one).
+ Alternatively, you can use the '-s NAME' parameter to specify
+ the name of target branch; the command will then take one more
+ argument describing a single commit to import.
+
tg update
~~~~~~~~~
Update the current topic branch wrt. changes in the branches
tg update
~~~~~~~~~
Update the current topic branch wrt. changes in the branches
diff --git
a/tg-import.sh
b/tg-import.sh
index 799efc9a8395228604e1ccf94cc66a0c36144ec9..6f8c8daf08d2bc6abb14d4bb22d49995f4463730 100644
(file)
--- a/
tg-import.sh
+++ b/
tg-import.sh
@@
-5,6
+5,7
@@
# GPLv2
branch_prefix=t/
# GPLv2
branch_prefix=t/
+single=
ranges=
ranges=
@@
-15,8
+16,10
@@
while [ -n "$1" ]; do
case "$arg" in
-p)
branch_prefix="$1"; shift;;
case "$arg" in
-p)
branch_prefix="$1"; shift;;
+ -s)
+ single="$1"; shift;;
-*)
-*)
- echo "Usage: tg [...] import
[-p PREFIX] RANGE...
" >&2
+ echo "Usage: tg [...] import
{[-p PREFIX] RANGE...|-s NAME COMMIT}
" >&2
exit 1;;
*)
ranges="$ranges $arg";;
exit 1;;
*)
ranges="$ranges $arg";;
@@
-58,9
+61,9
@@
get_branch_name()
process_commit()
{
commit="$1"
process_commit()
{
commit="$1"
- branch_name=
$(get_branch_name "$commit")
- info "---- Importing $commit to $branch_
prefix$branch_
name"
- tg create "$branch_
prefix""$branch_
name"
+ branch_name=
"$2"
+ info "---- Importing $commit to $branch_name"
+ tg create "$branch_name"
git cherry-pick --no-commit "$commit"
get_commit_msg "$commit" > .topmsg
git add -f .topmsg .topdeps
git cherry-pick --no-commit "$commit"
get_commit_msg "$commit" > .topmsg
git add -f .topmsg .topdeps
@@
-68,6
+71,11
@@
process_commit()
info "++++ Importing $commit finished"
}
info "++++ Importing $commit finished"
}
+if [ -n "$single" ]; then
+ process_commit "$ranges" "$single"
+ exit
+fi
+
# nice arg verification stolen from git-format-patch.sh
for revpair in $ranges
do
# nice arg verification stolen from git-format-patch.sh
for revpair in $ranges
do
@@
-92,7
+100,7
@@
do
info "Merged already: $comment"
;;
*)
info "Merged already: $comment"
;;
*)
- process_commit "$rev"
+ process_commit "$rev"
"$branch_prefix$(get_branch_name "$rev")"
;;
esac
done
;;
esac
done