/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to dev/reset

  • Committer: Tim Marston
  • Date: 2016-05-22 16:45:54 UTC
  • Revision ID: tim@ed.am-20160522164554-n5qhuibvnv0z4tk1
- fixed logic for vcard field types (home, work, cell, etc) so it works
- updated NEWS and TODO
- rewrote most of ContactsCache, including a new ContactIdentifier class to identify contacts in the cache and new cache building code
- contacts now identified in the same way that Andoid displays them (by name, or organisation, or number, or email, in that order)
- propper handling and support for organisations and titles
- validation of imported contact now done by Importer, not VcfImporter
- separated sanitisation and normalisation (for cache lookups)
- generacised PhoneData, EmailData and AddressData classes
- ContactData is now aware of primary numbers, emails and organisations (defaults to the first prefrred one seen, or the first one seen where none is preferred)added general reporting to CopyBase and configured it via copy-in and copy-out
walkers (it is required in copy in, during add command); added -R (recursive)
flass to add command; allow vcs backends to augment statically ignored files
list; added detection of out of date working copy to bzr backend;
generate_walk_list() now takes a mandatory directory as the first argument;
don't copy entire subtree during copy of missing directory (as this makes
assumptions about what's in the walk-list)

Show diffs side-by-side

added added

removed removed

 
1
#!/bin/bash
 
2
 
 
3
CURRENT=
 
4
if [ -d ~/.stdhome.orig -a ! -d ~/.stdhome.dev ]; then
 
5
        CURRENT=on
 
6
elif [ ! -d ~/.stdhome.orig -a -d ~/.stdhome.dev ]; then
 
7
        CURRENT=off
 
8
fi
 
9
 
 
10
if [ -z "$CURRENT" ]; then
 
11
        echo "Can't determine current state" >&2
 
12
        exit 1
 
13
fi
 
14
 
 
15
if [ "$CURRENT" == "off" ]; then
 
16
        echo "Dev environment is off" >&2
 
17
        exit 1
 
18
fi
 
19
 
 
20
# revno?
 
21
REVNO=
 
22
if [ -n "$1" ]; then
 
23
        if [ $(( 0 + $1 )) -gt 0 ]; then
 
24
                REVNO=$(( 0 + $1 ))
 
25
        fi
 
26
fi
 
27
 
 
28
# check/create reset dir
 
29
if [ ! -d ~/.stdhome.dev.reset/home -a ! -d ~/.stdhome/home ]; then
 
30
        echo "No ~/.stdhome.dev/home and nothing to copy it from"
 
31
        exit 1
 
32
fi
 
33
if [ ! -d ~/.stdhome.dev.reset/home ]; then
 
34
        echo copying dev environment to initial snapshot
 
35
        rm -rf ~/.stdhome.dev.reset
 
36
        cp -a ~/.stdhome ~/.stdhome.dev.reset
 
37
fi
 
38
 
 
39
# update repo
 
40
echo updating repo snapshot
 
41
cd ~/.stdhome.dev.reset/home
 
42
bzr up
 
43
cd
 
44
 
 
45
# reset repos
 
46
echo resetting repo
 
47
rm -rf ~/.stdhome
 
48
cp -a ~/.stdhome{.dev.reset,}
 
49
 
 
50
# revert stage
 
51
if [ -n "$REVNO" ]; then
 
52
        echo applying revno $REVNO
 
53
        /usr/local/bin/stdhome stage-revert
 
54
        cd ~/.stdhome/home
 
55
        bzr up -r $REVNO
 
56
        cd
 
57
fi
 
58
 
 
59
# reset "home" dir
 
60
echo resetting homedir
 
61
rm -rf ~/tmp/stdhome-dev
 
62
cp -a ~/.stdhome/home ~/tmp/stdhome-dev