Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
e62b4034
Commit
e62b4034
authored
Dec 13, 2011
by
Yasuhiro Matsumoto
Committed by
Russ Cox
Dec 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codereview: fix path slash issue.
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/5487057
parent
0e9ee93c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
codereview.py
lib/codereview/codereview.py
+11
-6
No files found.
lib/codereview/codereview.py
View file @
e62b4034
...
...
@@ -1065,25 +1065,30 @@ class uiwrap(object):
ui
.
verbose
=
self
.
oldVerbose
return
ui
.
popbuffer
()
def
to_slash
(
path
):
if
sys
.
platform
==
"win32"
:
return
path
.
replace
(
'
\\
'
,
'/'
)
return
path
def
hg_matchPattern
(
ui
,
repo
,
*
pats
,
**
opts
):
w
=
uiwrap
(
ui
)
hg_commands
.
status
(
ui
,
repo
,
*
pats
,
**
opts
)
text
=
w
.
output
()
ret
=
[]
prefix
=
os
.
path
.
realpath
(
repo
.
root
)
+
'/'
prefix
=
to_slash
(
os
.
path
.
realpath
(
repo
.
root
)
)
+
'/'
for
line
in
text
.
split
(
'
\n
'
):
f
=
line
.
split
()
if
len
(
f
)
>
1
:
if
len
(
pats
)
>
0
:
# Given patterns, Mercurial shows relative to cwd
p
=
os
.
path
.
realpath
(
f
[
1
]
)
p
=
to_slash
(
os
.
path
.
realpath
(
f
[
1
])
)
if
not
p
.
startswith
(
prefix
):
print
>>
sys
.
stderr
,
"File
%
s not in repo root
%
s.
\n
"
%
(
p
,
prefix
)
else
:
ret
.
append
(
p
[
len
(
prefix
):])
else
:
# Without patterns, Mercurial shows relative to root (what we want)
ret
.
append
(
f
[
1
]
)
ret
.
append
(
to_slash
(
f
[
1
])
)
return
ret
def
hg_heads
(
ui
,
repo
):
...
...
@@ -3139,7 +3144,7 @@ class VersionControlSystem(object):
unused
,
filename
=
line
.
split
(
':'
,
1
)
# On Windows if a file has property changes its filename uses '\'
# instead of '/'.
filename
=
filename
.
strip
()
.
replace
(
'
\\
'
,
'/'
)
filename
=
to_slash
(
filename
.
strip
()
)
files
[
filename
]
=
self
.
GetBaseFile
(
filename
)
return
files
...
...
@@ -3357,7 +3362,7 @@ class MercurialVCS(VersionControlSystem):
# A path
# M path
# etc
line
=
self
.
status
[
i
]
.
replace
(
'
\\
'
,
'/'
)
line
=
to_slash
(
self
.
status
[
i
]
)
if
line
[
2
:]
==
path
:
if
i
+
1
<
len
(
self
.
status
)
and
self
.
status
[
i
+
1
][:
2
]
==
' '
:
return
self
.
status
[
i
:
i
+
2
]
...
...
@@ -3424,7 +3429,7 @@ def SplitPatch(data):
# When a file is modified, paths use '/' between directories, however
# when a property is modified '\' is used on Windows. Make them the same
# otherwise the file shows up twice.
temp_filename
=
t
emp_filename
.
strip
()
.
replace
(
'
\\
'
,
'/'
)
temp_filename
=
t
o_slash
(
temp_filename
.
strip
()
)
if
temp_filename
!=
filename
:
# File has property changes but no modifications, create a new diff.
new_filename
=
temp_filename
...
...
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