Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183@title Diffusion User Guide: Repositories API@group userguideManaging repositories with the API.Overview========You can create and update Diffusion repositories using the Conduit API. Thismay be useful if you have a large number of existing repositories you wantto import or apply bulk actions to.For an introduction to Conduit, see @{article:Conduit API Overview}.In general, you'll use these API methods: - `diffusion.repository.edit`: Create and edit repositories. - `diffusion.uri.edit`: Create and edit repository URIs to configure observation, mirroring, and cloning.To create a repository, you'll generally do this: - Call `diffusion.repository.edit` to create a new object and configure basic information. - Optionally, call `diffusion.uri.edit` to add URIs to observe or mirror. - Call `diffusion.repository.edit` to activate the repository.This workflow mirrors the workflow from the web UI. The remainder of thisdocument walks through this workflow in greater detail.Create a Repository===================To create a repository, call `diffusion.repository.edit`, providing anyproperties you want to set. For simplicity these examples will use thebuiltin `arc call-conduit` client, but you can use whatever Conduit clientyou prefer.When creating a repository, you must provide a `vcs` transaction to choosea repository type, one of: `git`, `hg` or `svn`.You must also provide a `name`.Other properties are optional. Review the Conduit method documentation from theweb UI for an exhaustive list.```$ echo '{ "transactions": [ { "type": "vcs", "value": "git" }, { "type": "name", "value": "Poetry" } ]}' | arc call-conduit diffusion.repository.edit --```If things work, you should get a result that looks something like this:```lang=json{ ... "response": { "object": { "id": 1, "phid": "PHID-REPO-7vm42oayez2rxcmpwhuv" }, ... } ...}```If so, your new repository has been created. It hasn't been activated yet soit will not show up in the default repository list, but you can find it in theweb UI by browsing to {nav Diffusion > All Repositories}.Continue to the next step to configure URIs.Configure URIs==============Now that the repository exists, you can add URIs to it. This is optional,and if you're creating a //hosted// repository you may be able to skip thisstep.However, if you want Phorge to observe an existing remote, you'llconfigure it here by adding a URI in "Observe" mode. Use the PHID from theprevious step to identify the repository you want to add a URI to, and call`diffusion.uri.edit` to create a new URI in Observe mode for the repository.You need to provide a `repository` to add the URI to, and the `uri` itself.To add the URI in Observe mode, provide an `io` transaction selecting`observe` mode.You may also want to provide a `credential`.```$ echo '{ "transactions": [ { "type": "repository", "value": "PHID-REPO-7vm42oayez2rxcmpwhuv" }, { "type": "uri", "value": "https://github.com/epriestley/poems.git" }, { "type": "io", "value": "observe" } ]}' | arc call-conduit diffusion.uri.edit --```You should get a response that looks something like this:```lang=json{ ... "response": { "object": { "id": 1, "phid": "PHID-RURI-zwtho5o7h3m6rjzgsgrh" }, ... } ...}```If so, your URI has been created. You can review it in the web UI, under{nav Manage Repository > URIs}.When satisfied, continue to the next step to activate the repository.Activate the Repository=======================Now that any URIs have been configured, activate the repository with anothercall to `diffusion.repository.edit`. This time, modify the existing repositoryinstead of creating a new one:```$ echo '{ "objectIdentifier": "PHID-REPO-7vm42oayez2rxcmpwhuv", "transactions": [ { "type": "status", "value": "active" } ]}' | arc call-conduit diffusion.repository.edit```If that goes through cleanly, you should be all set. You can review therepository from the web UI.Editing Repositories====================To edit an existing repository, apply changes normally with`diffusion.repository.edit`. For more details on using edit endpoints, see@{article:Conduit API: Using Edit Endpoints}.Next Steps==========Continue by: - returning to the @{article:Diffusion User Guide}.