Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92628239
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, Nov 22, 04:52
Size
799 B
Mime Type
text/x-php
Expires
Sun, Nov 24, 04:52 (2 d)
Engine
blob
Format
Raw Data
Handle
22473587
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).
*
* @group mercurial
*/
function
hgsprintf
(
$pattern
/* , ... */
)
{
$args
=
func_get_args
();
return
xsprintf
(
'xsprintf_mercurial'
,
null
,
$args
);
}
/**
* xsprintf() callback for Mercurial encoding.
*
* @group mercurial
*/
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