aboutsummaryrefslogtreecommitdiffstats
path: root/copydb-current-branch
blob: 1ed6f2bc645d2682074e2be27c012a120bf6d42a (plain)
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
#!/usr/bin/zsh
## copydb-current-branch --- Create a copy of a database for the current branch

## Commentary:

# Use `copydb' to create a copy of the database named after the
# current branch. This requires the current working directory to be a
# git repository. The name of the database is created by substituting
# all occurrences of `-' with `_'. The database copied from is always
# called `aeos_babel'. The database copied to is called
# `aeos_<branchname>'.

# This program is just a wrapper for `copydb', so all information
# related to it is also relevant, please read its comments for more
# info.

# Usage is:

#    copydb-current-branch

## Code:

base="aeos_master"
branch=$(git branch --no-color | grep '*' | sed -e 's/* //' -e 's/-/_/g')
nbranch="aeos_${branch}"

echo Copying "$base" to "$nbranch"
copydb "$base" "$nbranch"