@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
at upstream/main 450 lines 17 kB view raw
1@title Diffusion User Guide: Managing Repositories 2@group userguide 3 4Guide to configuring and managing repositories in Diffusion. 5 6Overview 7======== 8 9After you create a new repository in Diffusion or select **Manage Repository** 10from the main screen if an existing repository, you'll be taken to the 11repository management interface for that repository. 12 13On this interface, you'll find many options which allow you to configure the 14behavior of a repository. This document walks through the options. 15 16Basics 17====== 18 19The **Basics** section of the management interface allows you to configure 20the repository name, description, and identifiers. You can also activate or 21deactivate the repository here, and configure a few other miscellaneous 22settings. 23 24Basics: Name 25============ 26 27The repository name is a human-readable primary name for the repository. It 28does not need to be unique 29 30Because the name is not unique and does not have any meaningful restrictions, 31it's fairly ambiguous and isn't very useful as an identifier. The other basic 32information (primarily callsigns and short names) gives you control over 33repository identifiers. 34 35 36Basics: Callsigns 37================= 38 39Each repository can optionally be identified by a "callsign", which is a short 40uppercase string like "P" (for Phorge) or "ARC" (for Arcanist). 41 42The primary goal of callsigns is to namespace commits to SVN repositories: if 43you use multiple SVN repositories, each repository has a revision 1, revision 2, 44etc., so referring to them by number alone is ambiguous. 45 46However, even for Git and Mercurial they impart additional information to human 47readers and allow parsers to detect that something is a commit name with high 48probability (and allow distinguishing between multiple copies of a repository). 49 50Configuring a callsign can make interacting with a commonly-used repository 51easier, but you may not want to bother assigning one to every repository if you 52have some similar, templated, or rarely-used repositories. 53 54If you choose to assign a callsign to a repository, it must be unique within an 55install but do not need to be globally unique, so you are free to use the 56single-letter callsigns for brevity. For example, Facebook uses "E" for the 57Engineering repository, "O" for the Ops repository, "Y" for a Yum package 58repository, and so on, while Phorge uses "P" and Arcanist uses "ARC". 59Keeping callsigns brief will make them easier to use, and the use of 60one-character callsigns is encouraged if they are reasonably evocative. 61 62If you configure a callsign like `XYZ`, Phorge will activate callsign URIs 63and activate the callsign identifier (like `rXYZ`) for the repository. These 64more human-readable identifiers can make things a little easier to interact 65with. 66 67 68Basics: Short Name 69================== 70 71Each repository can optionally have a unique short name. Short names must be 72unique and have some minor restrictions to make sure they are unambiguous and 73appropriate for use as directory names and in URIs. 74 75 76Basics: Description 77=================== 78 79You may optionally provide a brief (or, at your discretion, excruciatingly 80long) human-readable description of the repository. This description will be 81shown on the main repository page. 82 83You can also create a `README` file at the repository root (or in any 84subdirectory) to provide information about the repository. These formats are 85supported: 86 87| File Name | Rendered As... 88|-------------------|--------------- 89| `README` | Plain Text 90| `README.txt` | Plain Text 91| `README.remarkup` | Remarkup 92| `README.md` | Remarkup 93| `README.rainbow` | Rainbow 94 95 96Basics: Encoding 97================ 98 99Before content from the repository can be shown in the web UI or embedded in 100other contexts like email, it must be converted to UTF-8. 101 102Most source code is written in UTF-8 or a subset of UTF-8 (like plain ASCII) 103already, so everything will work fine. The majority of repositories do not need 104to adjust this setting. 105 106If your repository is primarily written in some other encoding, specify it here 107so Phorge can convert from it properly when reading content to embed in 108a webpage or email. 109 110 111Basics: Dangerous Changes 112========================= 113 114By default, repositories are protected against dangerous changes. Dangerous 115changes are operations which rewrite or destroy repository history (for 116example, by deleting or rewriting branches). Normally, these take the form 117of `git push --force` or similar. 118 119It is normally a good idea to leave this protection enabled because most 120scalable workflows rarely rewrite repository history and it's easy to make 121mistakes which are expensive to correct if this protection is disabled. 122 123If you do occasionally need to rewrite published history, you can treat this 124option like a safety: disable it, perform required rewrites, then enable it 125again. 126 127If you fully disable this at the repository level, you can still use Herald to 128selectively protect certain branches or grant this power to a limited set of 129users. 130 131This option is only available in Git and Mercurial, because it is impossible 132to make dangerous changes in Subversion. 133 134This option has no effect if a repository is not hosted because Phorge 135can not prevent dangerous changes in a remote repository it is merely 136observing. 137 138 139Basics: Disable Publishing 140========================== 141 142You can disable publishing for a repository. For more details on what this 143means, see @{article:Diffusion User Guide: Permanent Refs}. 144 145This is primarily useful if you need to perform major maintenance on a 146repository (like rewriting a large part of the repository history) and you 147don't want the maintenance to generate a large volume of email and 148notifications. You can disable publishing, apply major changes, wait for the 149new changes to import, and then reactivate publishing. 150 151 152Basics: Deactivate Repository 153============================= 154 155Repositories can be deactivated. Deactivating a repository has these effects: 156 157 - the repository will no longer be updated; 158 - users will no longer be able to clone/fetch/checkout the repository; 159 - users will no longer be able to push to the repository; and 160 - the repository will be hidden from view in default queries. 161 162When repositories are created for the first time, they are deactivated. This 163gives you an opportunity to customize settings, like adjusting policies or 164configuring a URI to observe. You must activate a repository before it will 165start working normally. 166 167 168Basics: Delete Repository 169========================= 170 171Repositories can not be deleted from the web UI, so this option only gives you 172information about how to delete a repository. 173 174Repositories can only be deleted from the command line, with `bin/remove`: 175 176``` 177$ ./bin/remove destroy <repository> 178``` 179 180This command will permanently destroy the repository. For more information 181about destroying things, see @{article:Permanently Destroying Data}. 182 183 184Policies 185======== 186 187The **Policies** section of the management interface allows you to review and 188manage repository access policies. 189 190You can configure granular access policies for each repository to control who 191can view, clone, administrate, and push to the repository. 192 193 194Policies: View 195============== 196 197The view policy for a repository controls who can view the repository from 198the web UI and clone, fetch, or check it out from Phorge. 199 200Users who can view a repository can also access the "Manage" interface to 201review information about the repository and examine the edit history, but can 202not make any changes. 203 204 205Policies: Edit 206============== 207 208The edit policy for a repository controls who can change repository settings 209using the "Manage" interface. In essence, this is permission to administrate 210the repository. 211 212You must be able to view a repository to edit it. 213 214You do not need this permission to push changes to a repository. 215 216 217Policies: Push 218============== 219 220The push policy for a repository controls who can push changes to the 221repository. 222 223This policy has no effect if Phorge is not hosting the repository, because 224it can not control who is allowed to make changes to a remote repository it is 225merely observing. 226 227You must also be able to view a repository to push to it. 228 229You do not need to be able to edit a repository to push to it. 230 231Further restrictions on who can push (and what they can push) can be configured 232for hosted repositories with Herald, which allows you to write more 233sophisticated rules that evaluate when Phorge receives a push. To get 234started with Herald, see @{article:Herald User Guide}. 235 236Additionally, Git and Mercurial repositories have a setting which allows 237you to **Prevent Dangerous Changes**. This setting is enabled by default and 238will prevent any users from pushing changes which rewrite or destroy history. 239 240 241URIs 242==== 243 244The **URIs** panel allows you to add and manage URIs which Phorge will 245fetch from, serve from, and push to. 246 247These options are covered in detail in @{article:Diffusion User Guide: URIs}. 248 249 250Limits 251====== 252 253The **Limits** panel allows you to configure limits and timeouts. 254 255**Filesize Limit**: Allows you to set a maximum filesize for any file in the 256repository. If a commit creates a larger file (or modifies an existing file so 257it becomes too large) it will be rejected. This option only applies to hosted 258repositories. 259 260This limit is primarily intended to make it more difficult to accidentally push 261very large files that shouldn't be version controlled (like logs, binaries, 262machine learning data, or media assets). Pushing huge datafiles by mistake can 263make the repository unwieldy by dramatically increasing how much data must be 264transferred over the network to clone it, and simply reverting the changes 265doesn't reduce the impact of this kind of mistake. 266 267**Clone/Fetch Timeout**: Configure the internal timeout for creating copies 268of this repository during operations like intracluster synchronization and 269Drydock working copy construction. This timeout does not affect external 270users. 271 272**Touch Limit**: Apply a limit to the maximum number of paths that any commit 273may touch. If a commit affects more paths than this limit, it will be rejected. 274This option only applies to hosted repositories. Users may work around this 275limit by breaking the commit into several smaller commits which each affect 276fewer paths. 277 278This limit is intended to offer a guard rail against users making silly 279mistakes that create obviously mistaken changes, like copying an entire 280repository into itself and pushing the result. This kind of change can take 281some effort to clean up if it becomes part of repository history. 282 283Note that if you move a file, both the old and new locations count as touched 284paths. You should generally configure this limit to be more than twice the 285number of files you anticipate any user ever legitimately wanting to move in 286a single commit. For example, a limit of `20000` will let users move up to 28710,000 files in a single commit, but will reject users mistakenly trying to 288push a copy of another repository or a directory with a million logfiles or 289whatever other kind of creative nonsense they manage to dream up. 290 291 292Branches 293======== 294 295The **Branches** panel allows you to configure how Phorge interacts with 296branches. 297 298This panel is not available for Subversion repositories, because Subversion 299does not have formal branches. 300 301You can configure a **Default Branch**. This controls which branch is shown by 302default in the UI. If no branch is provided, Phorge will use `master` in 303Git and `default` in Mercurial. 304 305**Fetch Refs**: In Git, if you are observing a remote repository, you can 306specify that you only want to fetch a subset of refs using "Fetch Refs". 307 308Normally, all refs (`refs/*`) are fetched. This means all branches, all tags, 309and all other refs. 310 311If you want to fetch only a few specific branches, you can list only those 312branches. For example, this will fetch only the branch "master": 313 314``` 315refs/heads/master 316``` 317 318You can fetch all branches and tags (but ignore other refs) like this: 319 320``` 321refs/heads/* 322refs/tags/* 323``` 324 325This may be useful if the remote is on a service like GitHub, GitLab, or 326Gerrit and uses custom refs (like `refs/pull/` or `refs/changes/`) to store 327metadata that you don't want to bring into Phorge. 328 329**Permanent Refs**: To learn more about permanent refs, see: 330 331 - @{article:Diffusion User Guide: Permanent Refs} 332 333By default, Phorge considers all branches to be permanent refs. If you 334only want some branches to be treated as permanent refs, specify them here. 335 336When specifying branches, you should enter one branch name per line. You can 337use regular expressions to match branches by wrapping an expression in 338`regexp(...)`. For example: 339 340| Example | Effect | 341|---------|--------| 342| `master` | Only the `master` branch is a permanent ref. 343| `regexp(/^release-/)` | Branches are permanent if they start with `release-`. 344| `regexp(/^(?!temp-)/)` | Branches named `temp-` are not permanent. 345 346 347Staging Area 348============ 349 350The **Staging Area** panel configures staging areas, used to make proposed 351changes available to build and continuous integration systems. 352 353For more details, see @{article:Harbormaster User Guide}. 354 355 356Automation 357========== 358 359The **Automation** panel configures support for allowing Phorge to make 360writes directly to the repository, so that it can perform operations like 361automatically landing revisions from the web UI. 362 363For details on repository automation, see 364@{article:Drydock User Guide: Repository Automation}. 365 366 367Symbols 368====== 369 370The **Symbols** panel allows you to customize how symbols (like class and 371function names) are linked when viewing code in the repository, and when 372viewing revisions which propose code changes to the repository. 373 374To take advantage of this feature, you need to do additional work to build 375symbol indexes. For details on configuring and populating symbol indexes, see 376@{article:User Guide: Symbol Indexes}. 377 378 379Repository Identifiers and Names 380================================ 381 382Repositories have several short identifiers which you can use to refer to the 383repository. For example, if you use command-line administrative tools to 384interact with a repository, you'll provide one of these identifiers: 385 386``` 387$ ./bin/repository update <identifier> 388``` 389 390The identifiers available for a repository depend on which options are 391configured. Each repository may have several identifiers: 392 393 - An **ID** identifier, like `R123`. This is available for all repositories. 394 - A **callsign** identifier, like `rXY`. This is available for repositories 395 with a callsign. 396 - A **short name** identifier, like `xylophone`. This is available for 397 repositories with a short name. 398 399All three identifiers can be used to refer to the repository in cases where 400the intent is unambiguous, but only the first two forms work in ambiguous 401contexts. 402 403For example, if you type `R123` or `rXY` into a comment, Phorge will 404recognize them as references to the repository. If you type `xylophone`, it 405assumes you mean the word "xylophone". 406 407Only the `R123` identifier is immutable: the others can be changed later by 408adjusting the callsign or short name for the repository. 409 410 411Commit Identifiers 412================== 413 414Diffusion uses repository identifiers and information about the commit itself 415to generate globally unique identifiers for each commit, like `rE12345`. 416 417Each commit may have several identifiers: 418 419 - A repository **ID** identifier, like `R123:abcdef123...`. 420 - A repository **callsign** identifier, like `rXYZabcdef123...`. This only 421 works if a repository has a callsign. 422 - Any unique prefix of the commit hash. 423 424Git and Mercurial use commit hashes to identify commits, and Phorge will 425recognize a commit if the hash prefix is unique and sufficiently long. Commit 426hashes qualified with a repository identifier must be at least 5 characters 427long; unqualified commit hashes must be at least 7 characters long. 428 429In Subversion, commit identifiers are sequential integers and prefixes can not 430be used to identify them. 431 432When rendering the name of a Git or Mercurial commit hash, Phorge tends to 433shorten it to 12 characters. This "short length" is relatively long compared to 434Git itself (which often uses 7 characters). See this post on the LKML for a 435historical explanation of Git's occasional internal use of 7-character hashes: 436 437https://lkml.org/lkml/2010/10/28/287 438 439Because 7-character hashes are likely to collide for even moderately large 440repositories, Diffusion generally uses either a 12-character prefix (which makes 441collisions very unlikely) or the full 40-character hash (which makes collisions 442astronomically unlikely). 443 444 445Next Steps 446========== 447 448Continue by: 449 450 - returning to the @{article:Diffusion User Guide}.