File tree 3 files changed +89
-0
lines changed
3 files changed +89
-0
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,25 @@ Enjoy,
28
28
29
29
- Andre Pang <ozone@algorithm.com.au>
30
30
31
+
32
+ git-svn-check-unpushed and git-svn-externals-check
33
+ ==================================================
34
+
35
+ In addition to the git-svn-clone-externals script I added two more
36
+ scripts:
37
+
38
+ * ``git-svn-check-unpushed`` tries to determine whether there are
39
+ commits which are not yet pushed back to the subversion
40
+ repository. I took this idea from Magit (an interface to the version
41
+ control system Git, implemented as an extension to Emacs) and
42
+ implemented it in Python instead of Lisp.x
43
+
44
+ * git-svn-externals-check is a script that displays whether there are
45
+ uncommitted changes or commits that are not pushed to the subversion
46
+ repository yet. Basically it executes ``git status`` and the
47
+ ``git-svn-check-unpushed`` scripts for each directory in the current
48
+ directory.
49
+
50
+ Feel free to use and improve these scripts.
51
+
52
+ - Mark van Lent <mark@vlent.nl>
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/python
2
+
3
+ from commands import getoutput
4
+ import sys
5
+ import logging
6
+
7
+ logger = logging .getLogger ()
8
+ console = logging .StreamHandler ()
9
+ formatter = logging .Formatter ('%(levelname)-8s %(message)s' )
10
+ console .setFormatter (formatter )
11
+ logger .addHandler (console )
12
+ logger .level = logging .INFO
13
+
14
+
15
+ def find_svn_branch_name ():
16
+ interesting_branches = ['remotes/git-svn' ,
17
+ 'remotes/trunk' ,
18
+ 'trunk' ]
19
+
20
+ gitbranch = getoutput ('git branch -a | cut -c3-' )
21
+
22
+ branches = gitbranch .split ('\n ' )
23
+ for branch in interesting_branches :
24
+ if branch in branches :
25
+ return branch
26
+
27
+
28
+ def find_uncommitted (svn_branch ):
29
+ output = getoutput ('git log --pretty="format:%%h %%s" %s..HEAD' %
30
+ svn_branch )
31
+ if output :
32
+ print 'Possible unpushed commits:'
33
+ print output
34
+ else :
35
+ print 'No unpushed commits found.'
36
+
37
+
38
+ if __name__ == '__main__' :
39
+ status = getoutput ('git status' )
40
+ if status .startswith ('fatal' ):
41
+ print status
42
+ sys .exit (1 )
43
+ svn_branch = find_svn_branch_name ()
44
+ if svn_branch is None :
45
+ print "No svn branch found"
46
+ sys .exit (1 )
47
+ logger .debug ('Found branch: %s' , svn_branch )
48
+ find_uncommitted (svn_branch )
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ for dir in * ; do
4
+ if [ -d $dir ]; then
5
+ cd $dir
6
+ STATUS=$( git status)
7
+ UNPUSHED=$( git-svn-check-unpushed)
8
+ if [ $( echo $STATUS | grep -c " clean" ) -lt 1 -o \
9
+ $( echo $UNPUSHED | grep -c " No unpushed" ) -lt 1 ]; then
10
+ echo ' >>>>>>>>>>>>>>>>' $dir ' <<<<<<<<<<<<<<<<'
11
+ git status
12
+ git-svn-check-unpushed
13
+ echo ' ----------------------------------------'
14
+ else
15
+ echo $dir ' is clean'
16
+ fi
17
+ cd ..
18
+ fi
19
+ done
You can’t perform that action at this time.
0 commit comments