~abentley/bzrtools/bzrtools.dev

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
#! /bin/sh
## Copyright (C) 2004 Aaron Bentley
##
## See the file "COPYING" for further information about
## the copyright and warranty status of this work.

. "$abadir/aba-lib"

# executes the command ("$@" are the arguments after the command name)
cmd_exec()
{
  # scan through the parameters, finding the CHANGESET parameter
  parms=''
  until [ -z "$1" ]  # Until all parameters used up...
  do
    if expr $1 : '-' > /dev/null ; then
      parms="$parms $1"
      shift
    else
      if [ -f "$1" ] ; then
        tmpdir=`aba_mktempdir`
        tar -x -z --strip-path=1 -f "$1" -C "$tmpdir"
        if [ "$?" != "0" ] ; then
          /bin/rm -rf "$tmpdir"
          exit 2
        fi
        parms="$parms $tmpdir"
        shift
      else
        parms="$parms $1"
        tmpdir=''
        shift
      fi
      parms="$parms $@"
      break
    fi
  done  
  tla apply-changeset $parms
  result=$?
  if [ ! -z "$tmpdir" ] ; then
    /bin/rm -rf "$tmpdir"
  fi
  exit $result
}

# one-liner description for aba help
cmd_desc()
{
    aba_desc $(basename $0) "apply a whole-tree changeset (directory or tar.gz)"
}

# short help for aba command -h, --help
cmd_help()
{
    tla apply-changeset -h
    echo "This is the aba version and additionally accepts"
    echo "a tar.gz as the CHANGESET parameter, which is then"
    echo "unpacked transparently."
    echo ""
}

# extended help for aba command -H or aba help command
cmd_ext_help()
{
    tla apply-changeset -H
    echo "This is the aba version and additionally accepts"
    echo "a tar.gz as the CHANGESET parameter, which is then"
    echo "unpacked transparently."
    echo ""
}	

aba_run "$@"

# arch-tag: abb83fcf-a20b-4bbc-9ec0-24123dc5054a