topgit update

there is now a tg push command pushing branch and its base optionally
including all dependency

svn path=/nixpkgs/trunk/; revision=15328
This commit is contained in:
Marc Weber 2009-04-27 01:18:07 +00:00
parent 761e653515
commit 829e0da0e5
4 changed files with 120 additions and 15 deletions

View file

@ -48,19 +48,21 @@ rec {
};
topGit = stdenv.mkDerivation {
name = "TopGit-git-patched";
src = sourceByName "topGit"; # destination directory is patched
installPhase = ''
mkdir -p $out/etc/bash_completion.d
make install
mv contrib/tg-completion.bash $out/etc/bash_completion.d
'';
dontPatchELF = 1;
meta = {
description = "TopGit aims to make handling of large amount of interdependent topic branches easier";
homepage = http://repo.or.cz/w/topgit.git; # maybe there is also another one, I haven't checked
license = "GPLv2";
name = "TopGit-git-patched";
src = sourceByName "topGit"; # destination directory is patched
phases="unpackPhase patchPhase installPhase";
installPhase = ''
mkdir -p $out/etc/bash_completion.d
make prefix=$out \
install
mv contrib/tg-completion.bash $out/etc/bash_completion.d
'';
meta = {
description = "TopGit aims to make handling of large amount of interdependent topic branches easier";
homepage = http://repo.or.cz/w/topgit.git; # maybe there is also another one, I haven't checked
license = "GPLv2";
};
patches = [ ./print-update-ranges.patch ./tg-push.patch ];
};
tig = stdenv.mkDerivation {

View file

@ -0,0 +1,13 @@
diff --git a/tg.sh b/tg.sh
index 0804f73..ee5f67a 100644
--- a/tg.sh
+++ b/tg.sh
@@ -92,7 +92,7 @@ measure_branch()
else
_suffix="commit"
fi
- echo "$_commits/$_nmcommits $_suffix"
+ echo "$_commits/$_nmcommits $_suffix, git log "$_base".."$_bname" "
}
# branch_contains B1 B2

View file

@ -0,0 +1,90 @@
diff --git a/README b/README
index d2f095d..f90a7b3 100644
--- a/README
+++ b/README
@@ -480,6 +480,13 @@ tg update
TODO: tg update -a for updating all topic branches
+tg push
+~~~~~~~
+ git push remote branch doesn't push the base.
+ git push remote pushes all branches (and bases)
+ You use tg push [-r] to push only the current branch [ and deps] with
+ its base to a remote location.
+
TODO: tg rename
diff --git a/tg-push.sh b/tg-push.sh
new file mode 100644
index 0000000..0f8c964
--- /dev/null
+++ b/tg-push.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# GPLv2
+
+recurse=
+remotes=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+ arg="$1"; shift
+ case "$arg" in
+ -r)
+ recurse=1;;
+ *)
+ remotes="$remotes $arg";;
+ esac
+done
+
+if [ -z "$remotes" ]; then
+ remotes="$(git config topgit.remote 2>/dev/null)"
+fi
+
+if [ -z "$remotes" ]; then
+ die "no remote location given. Either add a remote as additional argument or set topgit.remote"
+fi
+
+name="$(git symbolic-ref HEAD | sed 's#^refs/heads/##')"
+ref_exists "$name" || die "detached HEAD? Can't push that"
+
+push_branch(){
+ [ -z "${_dep##*remotes/*}" -o -z "$_dep_is_tgish" ] && return # don't push remotes
+ echo "$_dep" >> "$to_be_pushed"
+ base="top-bases/$_dep"
+ if ref_exists "$base"; then
+ echo "top-bases/$_dep" >> "$to_be_pushed"
+ else
+ echo "warning, no base found $base"
+ fi
+}
+
+to_be_pushed="$(mktemp -t tg-depsfile.XXXXXX)"
+trap 'rm -rf "$to_be_pushed"' EXIT
+
+for remote in $remotes; do
+ : > $to_be_pushed # empty file
+
+ if [ -n "$recurse" ]; then
+ recurse_deps push_branch "$name"
+ fi
+ _dep="$name"
+ _dep_is_tgish=1
+ push_branch
+ echo git push $remote `cat $to_be_pushed`
+ git push $remote `cat $to_be_pushed`
+done
diff --git a/tg-push.txt b/tg-push.txt
new file mode 100644
index 0000000..de9b259
--- /dev/null
+++ b/tg-push.txt
@@ -0,0 +1,3 @@
+ push branch and base. If you also use -r all tgish dependencies
+ will be pushed as well.
+ Use tg push remoteA remoteB to push to remoteA and remoteB locations

View file

@ -231,9 +231,9 @@
url = "http://mawercer.de/~nix/repos/zsh-2008-12-21_12-50-23.tar.gz";
sha256 = "9af16f89205759d7ade51268dbdfa02cec3db10b35dc7a56ffe8e1fde2074ae7";
};
topGit = args: with args; fetchurl { # Tue Jan 20 21:29:50 UTC 2009
url = "http://mawercer.de/~nix/repos/topGit-5b823563a678fe46ddf768977ab9d00525945ec6.tar.gz";
sha256 = "e027311b2b058bab05a7175546854d61325bba591109e68c59209edc6939e5cb";
topGit = args: with args; fetchurl { # Thu Apr 16 17:11:03 CEST 2009
url = "http://mawercer.de/~nix/repos/topGit-9f685cd79b36ff9459f2d1d8ba0c21fa8875ffad.tar.gz";
sha256 = "e2c82e8812a3f019e23b052c03000a5752a446dbea26cbfe91ef68a552c4c429";
};
qgit = args: with args; fetchurl { # Tue Jan 20 21:35:00 UTC 2009
url = "http://mawercer.de/~nix/repos/qgit-b5dd5fd691e9423124cf356abe26e641bc33d159.tar.gz";