Skip to content

Instantly share code, notes, and snippets.

@rctay
Created August 3, 2011 11:11
Show Gist options
  • Select an option

  • Save rctay/1122404 to your computer and use it in GitHub Desktop.

Select an option

Save rctay/1122404 to your computer and use it in GitHub Desktop.
useful shell history
# dulwich - test commands
python setup.py test -s dulwich.tests
python setup.py test -s dulwich.tests.test_repository.RepositoryTests
# with nose - exclude compat
nosetests -e compat
# helper - you must define this!
# usage: set $(split_remote_ref $arg)
# resulting $1=remote and $2=b/r
# use this if you want to accept refs of form b and b/r
split_remote_ref() {
IFS=/;
set -- $1;
echo $1 $1/${2:-master};
}
#
# from git...
#
# start git-daemon
git daemon --base-path="/media/shared/" --listen=localhost --enable=receive-pack --export-all --reuseaddr &
# on the originating-side, bundle up commits
bundle4hg_show() { git log refs/remotes/hg/$1..refs/heads/$1; }
bundle4hg() {
set $(split_remote_ref $1);
git bundle create /f/Temp/shared/foo.bundle refs/remotes/hg/$2..refs/heads/$2 \
&& git update-ref -m "bundled for hg" refs/remotes/hg/$2 refs/heads/$2^{};
}
# on the receiving side (a bare repo), unbundle
unbundle() {
set $(split_remote_ref $1);
git fetch ../foo.bundle $2 \
&& git update-ref -m "unbundled" refs/heads/$2 FETCH_HEAD^{};
}
# what I think git-pull does (I don't use it so I don't know if it's right)
pull() {
set $(split_remote_ref $1);
git checkout $2 && git merge --ff-only hg/$2;
}
#
# from hg...
#
# pull and update bookmark
pullb() {
lines=$(hg incoming -l 1 -n $1) \
|| { echo "no changes found" && return; };
r=$(echo "$lines" | sed '3!d;q' | awk '{print $2;}');
hg pull $1 && hg bookmark -f ${2:-$1/master} -r $r;
}
# push a bookmarked rev
# pushb remote [bookmark]
pushb() {
hg push $1 -r ${2:-$1/master};
}
# update a bookmark with less keystrokes
upb() {
rev=$2;
set $(split_remote_ref $1);
hg bookmark -f $2 -r $rev;
}
# diff-related
$ prove t8001-annotate.sh t8002-blame.sh $(ls -1 | grep -P '^t\d{4}-(diff|merge)[-.]') --state=hot,last,save
# http
$ prove -j9 $(ls -1 | grep -P '^t\d{4}-(http)[-.]')
# from tests/ directory
python run-tests.py -v --with-hg=/usr/local/lib/python2.6/dist-packages/mercurial/ -f
# wow, this is simple
make tests TESTFLAGS="-v -f"
# build quickly
JAVA_HOME=/f/Program\ Files\ \(x86\)/Java/jdk1.6.0_23/ /f/files/tools/maven/bin/mvn -pl org.eclipse.jgit.pgm -am install
# I also have this patch that disable building of docs for faster builds
cat <<EOF | patch -p1
diff --git a/pom.xml b/pom.xml
index e591d26..a42081c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -309,6 +309,7 @@
<executions>
<execution>
<id>attach-javadocs</id>
+ <phase>none</phase>
<goals>
<goal>jar</goal>
</goals>
EOF
./configure --prefix=`pwd`/installation --disable-install-rdoc --with-baseruby=$HOME/ext/dev/rbenv/versions/1.9.3-p194/bin/ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment