1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Fix several safety issues with repository URIs

Summary:
See PHI234. Several issues here:

  - The warning about observing a repository in Read/Write mode checks the raw I/O type, not the effective I/O type. That means we can fail to warn if other URIs are set to "Default", and "Default" is "Read/Write" in practice.
  - There's just an actual typo which prevents the "Observe" version of this error from triggering properly.

Additionally, add more forceful warnings that "Observe" and "Mirror" mean that you want to //replace// a repository with another one, not that we somehow merge branches selectively. It isn't necessarily obvious that "Observe" doesn't mean "merge/union", since the reasons it can't in the general case are somewhat subtle (conflicts between refs with the same names, detecting ref deletion).

Test Plan:
Read documentation. Hit the error locally by trying to "Observe" while in Read/Write mode:

{F5302655}

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18810
This commit is contained in:
epriestley 2017-11-30 12:13:07 -08:00
parent f786c86a6a
commit 14cc0abeb3
2 changed files with 12 additions and 2 deletions

View file

@ -347,11 +347,11 @@ final class DiffusionURIEditor
continue;
}
$io_type = $uri->getIoType();
$io_type = $uri->getEffectiveIOType();
if ($io_type == PhabricatorRepositoryURI::IO_READWRITE) {
if ($no_readwrite) {
$readwite_conflict = $uri;
$readwrite_conflict = $uri;
break;
}
}

View file

@ -239,6 +239,11 @@ You can not add a URI in Observe mode if an existing builtin URI is in
authorities: the observed remote copy and the hosted local copy. Take the
other URI out of //Read/Write// mode first.
WARNING: If you observe a remote repository, the entire state of the working
copy that Phabricator maintains will be deleted and replaced with the state of
the remote. If some changes are present only in Phabricator's working copy,
they will be unrecoverably destroyed.
**Mirror**: Phabricator will push any changes made to this repository to the
remote URI, keeping a read-only mirror hosted at that URI up to date.
@ -251,6 +256,11 @@ It is possible to mirror a repository to another repository that is also
hosted by Phabricator by adding that other repository's URI, although this is
silly and probably very rarely of any use.
WARNING: If you mirror to a remote repository, the entire state of that remote
will be replaced with the state of the working copy Phabricator maintains. If
some changes are present only in the remote, they will be unrecoverably
destroyed.
**None**: Phabricator will not fetch changes from or push changes to this URI.
For builtin URIs, it will not let users fetch changes from or push changes to
this URI.