about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
0 files changed, 0 insertions, 0 deletions
ram <vc@akkartik.com> 2016-10-11 22:11:58 -0700 committer Kartik K. Agaram <vc@akkartik.com> 2016-10-11 22:11:58 -0700 3494' href='/akkartik/mu/commit/relayout?h=hlt&id=a03a6e4fa29add1b84a2376e7980f3d270ef10c3'>a03a6e4f ^
b1bbe92d ^
















d90fce40 ^
b1bbe92d ^
















810542f1 ^
b1bbe92d ^
















b1bbe92d ^
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
           

                                                                             

                                                                         
                                                             
















                                                 
                                          
















                                                
                            
















                                                
          
#!/bin/bash
# Helper to change the numerical prefixes across the repo, say if you want to
# create room between 023 and 024, and so on.
#
# Assumes there's only ever one file with any numeric prefix. If you move
# 003trace.test.cc you might need to do some manual patch-up.

if [[ $# -eq 0 && `git diff HEAD |wc -l` -gt 0 ]]
then
  echo "Uncommitted changes"
  exit
fi

if [[ $# -gt 0 ]] # dry run
then
  git() {
    echo $*
  }
fi

#

index=0
ls [0-9]* |grep -v "trace.test" |sort -n |
  while read file
  do
    echo $file >&2
    while [[ $file != `printf "%03d" $index`* ]]
    do
      echo
      index=$(($index+1))
    done
    echo $file
    index=$(($index+1))
  done > .layout

vim -c "set nu" .layout

#

root() {
  echo $1 |sed 's/^[0-9]*//'
}

index=0
cat .layout |
  while read file
  do
    if [ ! -z $file ]
    then
      newfile=`printf "%03d" $index``root $file`
      if [[ $newfile != $file ]]
      then
        git mv $file $newfile
      fi
    fi
    index=$(($index+1))
  done

rm .layout