Provide basic support for Subversion revprops

Summary:
Ref T11208. See that task for a more detailed description of revprops.

This allows revprop changes in a hosted Subversion repository if the repository has the "allow dangerous changes" flag set.

In the future, we could expand this into real Herald support, but the only use case we have for now is letting `svnsync` work.

Test Plan:
Edited revprops with `svn propset --revprop -r 2 propkey propvalue repositoryuri`:

  - Tried before patch, got a "configure a commit hook" error.
  - Tried after patch, got a "dangerous change" error.
  - Allowed dangerous changes.
  - Did a revprop edit.
  - Prevented dangerous changes.
  - Got an error again.
  - Made a normal commit to an SVN repository.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11208

Differential Revision: https://secure.phabricator.com/D16174
This commit is contained in:
epriestley
2016-06-24 08:48:06 -07:00
parent fd20b89b56
commit 89f9f97159
4 changed files with 102 additions and 37 deletions

View File

@@ -18,25 +18,14 @@ final class DiffusionRepositoryEditDangerousController
->getPanelURI();
if (!$repository->canAllowDangerousChanges()) {
if ($repository->isSVN()) {
return $this->newDialog()
->setTitle(pht('Not in Danger'))
->appendParagraph(
pht(
'It is not possible for users to push any dangerous changes '.
'to a Subversion repository. Pushes to a Subversion repository '.
'can always be reverted and never destroy data.'))
->addCancelButton($panel_uri);
} else {
return $this->newDialog()
->setTitle(pht('Unprotectable Repository'))
->appendParagraph(
pht(
'This repository can not be protected from dangerous changes '.
'because Phabricator does not control what users are allowed '.
'to push to it.'))
->addCancelButton($panel_uri);
}
return $this->newDialog()
->setTitle(pht('Unprotectable Repository'))
->appendParagraph(
pht(
'This repository can not be protected from dangerous changes '.
'because Phabricator does not control what users are allowed '.
'to push to it.'))
->addCancelButton($panel_uri);
}
if ($request->isFormPost()) {
@@ -57,18 +46,34 @@ final class DiffusionRepositoryEditDangerousController
if ($repository->shouldAllowDangerousChanges()) {
$title = pht('Prevent Dangerous Changes');
$body = pht(
'It will no longer be possible to delete branches from this '.
'repository, or %s push to this repository.',
$force);
if ($repository->isSVN()) {
$body = pht(
'It will no longer be possible to edit revprops in this '.
'repository.');
} else {
$body = pht(
'It will no longer be possible to delete branches from this '.
'repository, or %s push to this repository.',
$force);
}
$submit = pht('Prevent Dangerous Changes');
} else {
$title = pht('Allow Dangerous Changes');
$body = pht(
'If you allow dangerous changes, it will be possible to delete '.
'branches and %s push this repository. These operations can '.
'alter a repository in a way that is difficult to recover from.',
$force);
if ($repository->isSVN()) {
$body = pht(
'If you allow dangerous changes, it will be possible to edit '.
'reprops in this repository, including arbitrarily rewriting '.
'commit messages. These operations can alter a repository in a '.
'way that is difficult to recover from.');
} else {
$body = pht(
'If you allow dangerous changes, it will be possible to delete '.
'branches and %s push this repository. These operations can '.
'alter a repository in a way that is difficult to recover from.',
$force);
}
$submit = pht('Allow Dangerous Changes');
}