Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hg-windows-ci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
This instance will be upgraded to Heptapod 17.9.0rc1 on 2025-03-27 between 17:00 and 18:00 UTC+2
Show more breadcrumbs
mercurial
hg-windows-ci
Commits
224e9607
Commit
224e9607
authored
11 years ago
by
Matt Mackall
Browse files
Options
Downloads
Patches
Plain Diff
subrepo: sanitize non-hg subrepos
parent
b3483223
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/subrepo.py
+15
-0
15 additions, 0 deletions
mercurial/subrepo.py
with
15 additions
and
0 deletions
mercurial/subrepo.py
+
15
−
0
View file @
224e9607
...
...
@@ -312,6 +312,18 @@
if
abort
:
raise
util
.
Abort
(
_
(
"
default path for subrepository not found
"
))
def
_sanitize
(
ui
,
path
):
def
v
(
arg
,
dirname
,
names
):
if
os
.
path
.
basename
(
dirname
).
lower
()
!=
'
.hg
'
:
return
for
f
in
names
:
if
f
.
lower
()
==
'
hgrc
'
:
ui
.
warn
(
_
(
"
warning: removing potentially hostile .hg/hgrc in
'
%s
'"
%
path
))
os
.
unlink
(
os
.
path
.
join
(
dirname
,
f
))
os
.
walk
(
path
,
v
,
None
)
def
itersubrepos
(
ctx1
,
ctx2
):
"""
find subrepos in ctx1 or ctx2
"""
# Create a (subpath, ctx) mapping where we prefer subpaths from
...
...
@@ -988,6 +1000,7 @@
# update to a directory which has since been deleted and recreated.
args
.
append
(
'
%s@%s
'
%
(
state
[
0
],
state
[
1
]))
status
,
err
=
self
.
_svncommand
(
args
,
failok
=
True
)
_sanitize
(
self
.
_ui
,
self
.
_path
)
if
not
re
.
search
(
'
Checked out revision [0-9]+.
'
,
status
):
if
(
'
is already a working copy for a different URL
'
in
err
and
(
self
.
_wcchanged
()[:
2
]
==
(
False
,
False
))):
...
...
@@ -1248,6 +1261,7 @@
self
.
_gitcommand
([
'
reset
'
,
'
HEAD
'
])
cmd
.
append
(
'
-f
'
)
self
.
_gitcommand
(
cmd
+
args
)
_sanitize
(
self
.
_ui
,
self
.
_path
)
def
rawcheckout
():
# no branch to checkout, check it out with no branch
...
...
@@ -1331,6 +1345,7 @@
self
.
get
(
state
)
# fast forward merge
elif
base
!=
self
.
_state
[
1
]:
self
.
_gitcommand
([
'
merge
'
,
'
--no-commit
'
,
revision
])
_sanitize
(
self
.
_ui
,
self
.
_path
)
if
self
.
dirty
():
if
self
.
_gitstate
()
!=
revision
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment