summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-08-01 12:13:23 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-08-01 12:13:23 +0200
commit0a10c5490a1882e7a5d5422dc71970ab36bdd4fd (patch)
treeae3f09538d3dd36be64a9d7ac0c2d8979f284a6c
parentf989fb498c2b4f23d2dfc986123df465180651c3 (diff)
Added `pkg push`, pluss some minor fixes
-rwxr-xr-xbin/pkg41
1 files changed, 36 insertions, 5 deletions
diff --git a/bin/pkg b/bin/pkg
index 16838e0..a90dba3 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -26,7 +26,7 @@ die () {
}
check_installed () {
- [[ -n "$1" && -d $PDIR/$1 ]] || die "Not installed: $1\n"
+ [[ -n "$1" && -d $PDIR/$1 ]] || die "Not installed: '$1'\n"
}
check_valid () {
@@ -136,7 +136,7 @@ vcs_add () {
}
vcs_log () {
- [[ -d .hg ]] && {hg glog | less ; return}
+ [[ -d .hg ]] && {hg glog | less ; return}
[[ -d .git ]] && {git log ; return}
}
@@ -145,6 +145,11 @@ vcs_upgrade () {
[[ -d .git ]] && {git pull ; return}
}
+vcs_push () {
+ [[ -d .hg ]] && {hg push ; return}
+ [[ -d .git ]] && {git push ; return}
+}
+
vcs_status () {
$(list_type $1) status
}
@@ -366,6 +371,32 @@ pkg_add () {
list_update_package $1
}
+pkg_push () {
+ check_installed $1
+ check_valid $1
+ cd $PDIR/$1
+ info "Processing $1"
+ list_incoming $1
+ if [[ $? = 0 ]] {
+ clear_line
+ info "Pushing $1\n"
+ vcs_push
+ } else {
+ clear_line
+ }
+}
+
+pkg_push_wrapper () {
+ if [[ -n $1 ]] {
+ pkg_push $1
+ } else {
+ cd $PDIR
+ for i in *(/); {
+ pkg_push $i
+ }
+ }
+}
+
pkg_remove () {
check_installed $1
check_valid $1
@@ -385,10 +416,10 @@ pkg_remove () {
pkg_upgrade () {
check_installed $1
+ check_valid $1
cd $PDIR/$1
info "Looking for updates: $1"
- # TODO remove legacy
- NEW=$(list_incoming $1)
+ list_incoming $1
if [[ $? = 0 ]] {
clear_line
info "Updating $1 to $(list_remote_version $1)\n"
@@ -405,7 +436,6 @@ pkg_upgrade () {
} else {
clear_line
}
- cd $PDIR
}
# If no package was specified, update everything
@@ -563,6 +593,7 @@ case $1 in
list-all) pkg_list_available ;;
local-update) pkg_update_local ;;
log) pkg_log $2 ;;
+ push) pkg_push_wrapper $2 ;;
remote-update) pkg_update_remote ;;
remove) pkg_remove $2 ;;
status) pkg_status_wrapper $2 ;;