public
Description: Automate common steps when getting setup with git-svn.
Homepage: http://effectif.com/2008/4/24/easy-git-svn-for-rails
Clone URL: git://github.com/gma/git-me-up.git
Added support for specifying which revision(s) to clone.

Set the REVISION environment variable to a value suitable to passed 
through
to git-svn's -r switch.
Graham Ashton (author)
Tue Apr 29 15:20:03 -0700 2008
commit  aa67640100c03cd03381355e2427951501a2d01d
tree    8f3985003d28f1c987a41dbab4a62a4b16cb449f
parent  e302626d6375f0778ecd31dd29568a2b89edd774
0
...
7
8
9
10
11
 
 
12
13
14
15
 
16
17
18
...
46
47
48
49
 
 
 
 
 
 
 
 
 
 
50
51
52
...
7
8
9
 
 
10
11
12
13
14
 
15
16
17
18
...
46
47
48
 
49
50
51
52
53
54
55
56
57
58
59
60
61
0
@@ -7,12 +7,12 @@ projects.
0
 
0
 In a nutshell, this is what it does:
0
 
0
- - Clones the latest version of the source (skipping all the history for
0
- performance reasons) into a new local Git repository.
0
+ - Clones the latest version of the source (by default skipping the history
0
+ for performance reasons) into a new local Git repository.
0
 
0
   - Recreates empty directories (that git chooses to ignore), but that your
0
     app might need.
0
-
0
+
0
   - Converts any svn:ignore Subversion properties into entries in your
0
     .git/info/exclude file.
0
 
0
@@ -46,7 +46,16 @@ Git repository that you'd like to create.
0
 
0
 For example:
0
 
0
- $ git-me-up https://svn.mydomain.com/path/to/repo/project/trunk project
0
+ $ git-me-up http://svn.mydomain.com/repo/project/trunk project
0
+
0
+By default git-me-up will pull the latest version of your code from
0
+Subversion, ignoring all the history. If you want to override the revision
0
+pulled, set the REVISION environment variable, like this:
0
+
0
+ $ REVISION=123:HEAD http://svn.mydomain.com/repo/project/trunk project
0
+
0
+See the coverage of the -r option in the git-svn(1) man page for more examples
0
+of how to specify the revision.
0
 
0
 Give it a whirl. If you don't like it, delete your local directory. No harm
0
 done...
...
34
35
36
37
 
38
39
40
...
53
54
55
56
57
 
 
58
59
60
 
61
62
63
...
34
35
36
 
37
38
39
40
...
53
54
55
 
 
56
57
58
59
 
60
61
62
63
0
@@ -34,7 +34,7 @@ check_for_local_dir()
0
 get_latest_revision()
0
 {
0
     local repo="$1"
0
- svn log "$repo" | sed -n "2p" | cut -f 1 -d " "
0
+ svn log "$repo" | sed -n "2p" | cut -f 1 -d " " | sed "s/^r//"
0
 }
0
 
0
 ignore_generated_files()
0
@@ -53,11 +53,11 @@ clone_repository()
0
     local svn_repo="$1"
0
     local local_repo="$2"
0
     
0
- log "finding latest revision of $svn_repo"
0
- local revision=$(get_latest_revision "$svn_repo")
0
+ [ -z "$REVISION" ] && log "finding latest revision of $svn_repo"
0
+ local revision=${REVISION:-$(get_latest_revision "$svn_repo")}
0
     
0
     log "creating git repository in $(pwd)/$local_repo"
0
- local empty_dirs=$(git svn clone -$revision $svn_repo $local_repo 2>&1 | \
0
+ local empty_dirs=$(git svn clone -r $revision $svn_repo $local_repo 2>&1 | \
0
         grep "W: +empty_dir:" | cut -f 3 -d " ")
0
     local dir
0
     for dir in $empty_dirs; do

Comments

    No one has commented yet.