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
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
Show more breadcrumbs
mercurial
hg-windows-ci
Commits
27fbca75
Commit
27fbca75
authored
7 years ago
by
Pulkit Goyal
Browse files
Options
Downloads
Patches
Plain Diff
commitextras: make sure keys contains ascii letters, numbers, '_' and '-' only
parent
850d2ec2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hgext/commitextras.py
+6
-0
6 additions, 0 deletions
hgext/commitextras.py
tests/test-commit.t
+3
-0
3 additions, 0 deletions
tests/test-commit.t
with
9 additions
and
0 deletions
hgext/commitextras.py
+
6
−
0
View file @
27fbca75
...
...
@@ -9,6 +9,8 @@
from
__future__
import
absolute_import
import
re
from
mercurial.i18n
import
_
from
mercurial
import
(
commands
,
...
...
@@ -52,6 +54,10 @@
"
KEY=VALUE format
"
)
raise
error
.
Abort
(
msg
%
raw
)
k
,
v
=
raw
.
split
(
'
=
'
,
1
)
if
re
.
search
(
'
[^\w-]
'
,
k
):
msg
=
_
(
"
keys can only contain ascii letters, digits,
"
"
'
_
'
and
'
-
'"
)
raise
error
.
Abort
(
msg
)
if
k
in
usedinternally
:
msg
=
_
(
"
key
'
%s
'
is used internally, can
'
t be set
"
"
manually
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/test-commit.t
+
3
−
0
View file @
27fbca75
...
...
@@ -135,6 +135,9 @@
$ hg commit -m "adding internal used extras" --extra amend_source=hash
abort: key
'
amend_source
'
is used internally, can
'
t
be
set
manually
[
255
]
$
hg
commit
-
m "special chars in extra"
--
extra
id@phab
=
214
abort:
keys
can
only
contain
ascii
letters
,
digits
,
'
_
'
and
'
-
'
[
255
]
$
hg
commit
-
m "adding extras"
--
extra
sourcehash
=
foo
--
extra
oldhash
=
bar
$
hg
log
-
r
.
-
T
'
{extras % "{extra}\n"}
'
branch
=
default
...
...
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