Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
37927451
Commit
37927451
authored
Nov 05, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #997 from Dundee/py3_git_svn_gotorev
modified git_svn_gotorev.py to work with both py2 and py3
parents
a7d40608
adcea322
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
tools/git_svn_gotorev.py
tools/git_svn_gotorev.py
+13
-12
No files found.
tools/git_svn_gotorev.py
View file @
37927451
...
...
@@ -3,6 +3,7 @@
# - is faster
# - actually works
from
__future__
import
print_function
import
os
import
subprocess
import
sys
...
...
@@ -15,10 +16,10 @@ def find_rev(svn_id, fetch_if_necessary=True):
while
True
:
s
=
p
.
stdout
.
readline
()
if
s
.
startswith
(
"commit"
):
if
s
.
startswith
(
b
"commit"
):
commit
=
s
.
strip
().
split
()[
1
]
elif
s
.
startswith
(
" git-svn-id:"
):
rid
=
int
(
s
.
split
()[
1
].
split
(
'@'
)[
1
])
elif
s
.
startswith
(
b
" git-svn-id:"
):
rid
=
int
(
s
.
split
()[
1
].
split
(
b
'@'
)[
1
])
if
rid
<=
svn_rev
:
break
isfirst
=
False
...
...
@@ -30,16 +31,16 @@ def find_rev(svn_id, fetch_if_necessary=True):
if
isfirst
:
if
fetch_if_necessary
:
print
"Need to fetch the repo"
print
(
"Need to fetch the repo"
)
subprocess
.
check_call
([
"git"
,
"fetch"
],
cwd
=
repo
)
print
"Trying again"
print
(
"Trying again"
)
return
find_rev
(
svn_id
,
False
)
else
:
print
"This is the newest one??"
print
(
"This is the newest one??"
)
else
:
print
"Don't need to fetch"
print
(
"Don't need to fetch"
)
print
"Commit to go to is:"
,
commit
,
rid
print
(
"Commit to go to is:"
,
commit
,
rid
)
return
commit
,
rid
if
__name__
==
"__main__"
:
...
...
@@ -51,7 +52,7 @@ if __name__ == "__main__":
p
=
subprocess
.
Popen
([
"git"
,
"show"
,
"--format=short"
],
cwd
=
repo
,
stdout
=
subprocess
.
PIPE
)
cur_commit
=
p
.
stdout
.
readline
().
strip
().
split
()[
1
]
print
"Currently:"
,
cur_commit
print
(
"Currently:"
,
cur_commit
)
p
.
kill
()
# TODO: can't do this optimization now that we have patches to apply;
# maybe could try to determine that the patches are the same?
...
...
@@ -62,8 +63,8 @@ if __name__ == "__main__":
exitcode
=
subprocess
.
call
([
"git"
,
"diff"
,
"--exit-code"
],
cwd
=
repo
,
stdout
=
open
(
"/dev/null"
))
diffs
=
(
exitcode
!=
0
)
if
diffs
:
print
>>
sys
.
stderr
,
"Error: the llvm directory has modifications that would be lost!"
print
>>
sys
.
stderr
,
"Please stash or revert them before running this script."
print
(
"Error: the llvm directory has modifications that would be lost!"
,
file
=
sys
.
stderr
)
print
(
"Please stash or revert them before running this script."
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
subprocess
.
check_call
([
"git"
,
"diff"
,
"--dirstat"
,
commit
],
cwd
=
repo
)
...
...
@@ -96,7 +97,7 @@ if __name__ == "__main__":
code
=
subprocess
.
call
([
"git"
,
"am"
,
patch_fn
],
cwd
=
repo
)
if
code
!=
0
:
print
"Running 'git am --abort'..."
print
(
"Running 'git am --abort'..."
)
subprocess
.
check_call
([
"git"
,
"am"
,
"--abort"
],
cwd
=
repo
)
sys
.
exit
(
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment