Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97264847
hgsprintf.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 3, 21:45
Size
760 B
Mime Type
text/x-php
Expires
Sun, Jan 5, 21:45 (2 d)
Engine
blob
Format
Raw Data
Handle
23344347
Attached To
rPHU libphutil
hgsprintf.php
View Options
<?php
/**
* Format a Mercurial revset expression. Supports the following conversions:
*
* %s Symbol
* Escapes a Mercurial symbol, like a branch or bookmark name.
*
* %R Rrraw Rreferrrence / Rrrrevset
* Passes text through unescaped (e.g., an already-escaped revset).
*/
function
hgsprintf
(
$pattern
/* , ... */
)
{
$args
=
func_get_args
();
return
xsprintf
(
'xsprintf_mercurial'
,
null
,
$args
);
}
/**
* @{function:xsprintf} callback for Mercurial encoding.
*/
function
xsprintf_mercurial
(
$userdata
,
&
$pattern
,
&
$pos
,
&
$value
,
&
$length
)
{
$type
=
$pattern
[
$pos
];
switch
(
$type
)
{
case
's'
:
$value
=
"'"
.
addcslashes
(
$value
,
"'
\\
"
).
"'"
;
break
;
case
'R'
:
$type
=
's'
;
break
;
}
$pattern
[
$pos
]
=
$type
;
}
Event Timeline
Log In to Comment