Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61122613
get_repo_info.py
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
Sat, May 4, 16:34
Size
1006 B
Mime Type
text/x-python
Expires
Mon, May 6, 16:34 (2 d)
Engine
blob
Format
Raw Data
Handle
17468505
Attached To
rPHAPI Phabricator API scripts
get_repo_info.py
View Options
#!/usr/bin/env python2
import
sys
from
phabricator
import
Phabricator
def
usage
():
print
(
'''Usage:
{cmd} <RXXXX>
{cmd} <rAAAA>
Examples:
{cmd} R2
{cmd} rPHINFRA
'''
.
format
(
cmd
=
sys
.
argv
[
0
]))
if
len
(
sys
.
argv
)
<
2
:
usage
()
sys
.
exit
(
0
)
arg
=
sys
.
argv
[
1
]
if
arg
[
0
]
==
'R'
:
constraints
=
{
'ids'
:
[
arg
[
1
:]],
}
elif
arg
[
0
]
==
'r'
:
constraints
=
{
'callsigns'
:
[
arg
[
1
:]],
}
else
:
print
(
"Argument must start with r or R"
)
usage
()
sys
.
exit
(
1
)
attachments
=
{
'projects'
:
1
,
'uris'
:
1
,
}
phab
=
Phabricator
()
repo
=
phab
.
diffusion
.
repository
.
search
(
constraints
=
constraints
,
attachments
=
attachments
,
limit
=
1
)
data
=
repo
[
'data'
]
if
len
(
data
)
>
0
:
for
d
in
data
:
print
(
'{rid} {name} {phid} {fields}
\n
'
.
format
(
rid
=
d
[
'id'
],
phid
=
d
[
'phid'
],
name
=
d
[
'fields'
][
'name'
],
fields
=
d
[
'fields'
],
))
else
:
print
(
"Nothing found"
)
Event Timeline
Log In to Comment