Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
351e1d57
Commit
351e1d57
authored
Oct 05, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codereview: fix for Mercurial 1.9.2
R=golang-dev, adg CC=golang-dev
https://golang.org/cl/5127052
parent
a5f064a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
16 deletions
+36
-16
lib/codereview/codereview.py
lib/codereview/codereview.py
+36
-16
No files found.
lib/codereview/codereview.py
View file @
351e1d57
...
@@ -69,15 +69,6 @@ except:
...
@@ -69,15 +69,6 @@ except:
from
mercurial.version
import
version
as
v
from
mercurial.version
import
version
as
v
hgversion
=
v
.
get_version
()
hgversion
=
v
.
get_version
()
try
:
from
mercurial.discovery
import
findcommonincoming
from
mercurial.discovery
import
findoutgoing
except
:
def
findcommonincoming
(
repo
,
remote
):
return
repo
.
findcommonincoming
(
remote
)
def
findoutgoing
(
repo
,
remote
):
return
repo
.
findoutgoing
(
remote
)
# in Mercurial 1.9 the cmdutil.match and cmdutil.revpair moved to scmutil
# in Mercurial 1.9 the cmdutil.match and cmdutil.revpair moved to scmutil
if
hgversion
>=
'1.9'
:
if
hgversion
>=
'1.9'
:
from
mercurial
import
scmutil
from
mercurial
import
scmutil
...
@@ -116,6 +107,22 @@ def promptyesno(ui, msg):
...
@@ -116,6 +107,22 @@ def promptyesno(ui, msg):
except
AttributeError
:
except
AttributeError
:
return
ui
.
prompt
(
msg
,
[
"&yes"
,
"&no"
],
"y"
)
!=
"n"
return
ui
.
prompt
(
msg
,
[
"&yes"
,
"&no"
],
"y"
)
!=
"n"
def
incoming
(
repo
,
other
):
fui
=
FakeMercurialUI
()
ret
=
commands
.
incoming
(
fui
,
repo
,
*
[
other
.
path
],
**
{
'bundle'
:
''
,
'force'
:
False
})
if
ret
and
ret
!=
1
:
raise
util
.
Abort
(
ret
)
out
=
fui
.
output
return
out
def
outgoing
(
repo
):
fui
=
FakeMercurialUI
()
ret
=
commands
.
outgoing
(
fui
,
repo
,
*
[],
**
{})
if
ret
and
ret
!=
1
:
raise
util
.
Abort
(
ret
)
out
=
fui
.
output
return
out
# To experiment with Mercurial in the python interpreter:
# To experiment with Mercurial in the python interpreter:
# >>> repo = hg.repository(ui.ui(), path = ".")
# >>> repo = hg.repository(ui.ui(), path = ".")
...
@@ -813,10 +820,6 @@ def getremote(ui, repo, opts):
...
@@ -813,10 +820,6 @@ def getremote(ui, repo, opts):
os
.
environ
[
'http_proxy'
]
=
proxy
os
.
environ
[
'http_proxy'
]
=
proxy
return
other
return
other
def
Incoming
(
ui
,
repo
,
opts
):
_
,
incoming
,
_
=
findcommonincoming
(
repo
,
getremote
(
ui
,
repo
,
opts
))
return
incoming
desc_re
=
'^(.+: |(tag )?(release|weekly)
\
.|
f
ix build|undo CL)'
desc_re
=
'^(.+: |(tag )?(release|weekly)
\
.|
f
ix build|undo CL)'
desc_msg
=
'''Your CL description appears not to use the standard form.
desc_msg
=
'''Your CL description appears not to use the standard form.
...
@@ -964,6 +967,7 @@ def CommandLineCL(ui, repo, pats, opts, defaultcc=None):
...
@@ -964,6 +967,7 @@ def CommandLineCL(ui, repo, pats, opts, defaultcc=None):
# in that CL.
# in that CL.
original_match
=
None
original_match
=
None
global_repo
=
None
global_repo
=
None
global_ui
=
None
def
ReplacementForCmdutilMatch
(
ctx
,
pats
=
None
,
opts
=
None
,
globbed
=
False
,
default
=
'relpath'
):
def
ReplacementForCmdutilMatch
(
ctx
,
pats
=
None
,
opts
=
None
,
globbed
=
False
,
default
=
'relpath'
):
taken
=
[]
taken
=
[]
files
=
[]
files
=
[]
...
@@ -1634,8 +1638,9 @@ def pending(ui, repo, *pats, **opts):
...
@@ -1634,8 +1638,9 @@ def pending(ui, repo, *pats, **opts):
def
reposetup
(
ui
,
repo
):
def
reposetup
(
ui
,
repo
):
global
original_match
global
original_match
if
original_match
is
None
:
if
original_match
is
None
:
global
global_repo
global
global_repo
,
global_ui
global_repo
=
repo
global_repo
=
repo
global_ui
=
ui
start_status_thread
()
start_status_thread
()
original_match
=
scmutil
.
match
original_match
=
scmutil
.
match
scmutil
.
match
=
ReplacementForCmdutilMatch
scmutil
.
match
=
ReplacementForCmdutilMatch
...
@@ -1678,8 +1683,9 @@ def submit(ui, repo, *pats, **opts):
...
@@ -1678,8 +1683,9 @@ def submit(ui, repo, *pats, **opts):
# We already called this on startup but sometimes Mercurial forgets.
# We already called this on startup but sometimes Mercurial forgets.
set_mercurial_encoding_to_utf8
()
set_mercurial_encoding_to_utf8
()
other
=
getremote
(
ui
,
repo
,
opts
)
repo
.
ui
.
quiet
=
True
repo
.
ui
.
quiet
=
True
if
not
opts
[
"no_incoming"
]
and
Incoming
(
ui
,
repo
,
opts
):
if
not
opts
[
"no_incoming"
]
and
incoming
(
repo
,
other
):
return
"local repository out of date; must sync before submit"
return
"local repository out of date; must sync before submit"
cl
,
err
=
CommandLineCL
(
ui
,
repo
,
pats
,
opts
,
defaultcc
=
defaultcc
)
cl
,
err
=
CommandLineCL
(
ui
,
repo
,
pats
,
opts
,
defaultcc
=
defaultcc
)
...
@@ -1745,7 +1751,7 @@ def submit(ui, repo, *pats, **opts):
...
@@ -1745,7 +1751,7 @@ def submit(ui, repo, *pats, **opts):
set_status
(
"pushing "
+
cl
.
name
+
" to remote server"
)
set_status
(
"pushing "
+
cl
.
name
+
" to remote server"
)
other
=
getremote
(
ui
,
repo
,
opts
)
other
=
getremote
(
ui
,
repo
,
opts
)
if
findoutgoing
(
repo
,
other
):
if
outgoing
(
repo
):
raise
util
.
Abort
(
"local repository corrupt or out-of-phase with remote: found outgoing changes"
)
raise
util
.
Abort
(
"local repository corrupt or out-of-phase with remote: found outgoing changes"
)
m
=
match
.
exact
(
repo
.
root
,
repo
.
getcwd
(),
cl
.
files
)
m
=
match
.
exact
(
repo
.
root
,
repo
.
getcwd
(),
cl
.
files
)
...
@@ -3122,6 +3128,7 @@ class VersionControlSystem(object):
...
@@ -3122,6 +3128,7 @@ class VersionControlSystem(object):
return
False
return
False
return
not
mimetype
.
startswith
(
"text/"
)
return
not
mimetype
.
startswith
(
"text/"
)
class
FakeMercurialUI
(
object
):
class
FakeMercurialUI
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
quiet
=
True
self
.
quiet
=
True
...
@@ -3129,6 +3136,19 @@ class FakeMercurialUI(object):
...
@@ -3129,6 +3136,19 @@ class FakeMercurialUI(object):
def
write
(
self
,
*
args
,
**
opts
):
def
write
(
self
,
*
args
,
**
opts
):
self
.
output
+=
' '
.
join
(
args
)
self
.
output
+=
' '
.
join
(
args
)
def
copy
(
self
):
return
self
def
status
(
self
,
*
args
,
**
opts
):
pass
def
readconfig
(
self
,
*
args
,
**
opts
):
pass
def
expandpath
(
self
,
*
args
,
**
opts
):
return
global_ui
.
expandpath
(
*
args
,
**
opts
)
def
configitems
(
self
,
*
args
,
**
opts
):
return
global_ui
.
configitems
(
*
args
,
**
opts
)
def
config
(
self
,
*
args
,
**
opts
):
return
global_ui
.
config
(
*
args
,
**
opts
)
use_hg_shell
=
False
# set to True to shell out to hg always; slower
use_hg_shell
=
False
# set to True to shell out to hg always; slower
...
...
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