PluginProbe
Parse.ly / 1.12.2
Parse.ly v1.12.2
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / init.py

init.py in Parse.ly 1.12.2, at init.py

57 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 #!/usr/bin/env python
2 '''
3 Initializes the wp-parsely git code repo locally and configures git to add
4 WordPress SVN repo.
5 '''
6 from __future__ import print_function
7 from subprocess import check_output, check_call, call
8 import os
9 import sys
10
11
12 def latest_revision(svn_repo):
13 revision = check_output('svn log -r 1:HEAD --limit 1 {}'.format(svn_repo), shell=True)
14 revision = revision.split('\n')
15 if len(revision) < 2:
16 return
17
18 revision = revision[1].split(' ')[0]
19 return revision
20
21
22 def main():
23 if os.path.exists('.git'):
24 print('Found .git folder in current directory, this script should not '
25 'be run inside a git repository (did you already git clone?).',
26 file=sys.stderr)
27 sys.exit(1)
28
29 plugin_name = 'wp-parsely'
30 svn_repo = 'http://plugins.svn.wordpress.org/{}/'.format(plugin_name)
31 git_repo = 'git@github.com:Parsely/wp-parsely.git'
32 print('Determining latest revision for {}'.format(plugin_name))
33 revision = latest_revision(svn_repo)
34 if not revision:
35 print('Could not find a revision number for svn repo.',
36 file=sys.stderr)
37 sys.exit(1)
38
39 check_call('git svn clone --no-minimize-url -s -{} {}'.format(revision, svn_repo),
40 shell=True)
41
42 print('Fetching all commits from SVN repo')
43 check_call('git svn fetch --log-window-size 10000', cwd=plugin_name,
44 shell=True)
45 check_call('git svn rebase', cwd=plugin_name, shell=True)
46
47 print('Initializing git')
48 check_call('git remote add origin {}'.format(git_repo), cwd=plugin_name,
49 shell=True)
50 print('git origin {} added'.format(git_repo))
51 print('Done.')
52
53
54
55 if __name__ == '__main__':
56 main()
57