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