1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Make some UI things less confusing and reduce the amount of horrific torture

that arc apparently inflicts upon users.

Summary:

Test Plan: .

Reviewers:

CC:

Differential Revision: 223104
This commit is contained in:
epriestley 2011-03-12 17:57:35 -08:00
parent fd19dfaebc
commit 982e482290
5 changed files with 59 additions and 7 deletions

View file

@ -33,9 +33,13 @@ abstract class ArcanistRepositoryAPI {
const FLAG_UNCOMMITTED = 128; const FLAG_UNCOMMITTED = 128;
const FLAG_EXTERNALS = 256; const FLAG_EXTERNALS = 256;
// Occurs in SVN when you replace a file with a directory. // Occurs in SVN when you replace a file with a directory without telling
// SVN about it.
const FLAG_OBSTRUCTED = 512; const FLAG_OBSTRUCTED = 512;
// Occurs in SVN when an update was interrupted or failed, e.g. you ^C'd it.
const FLAG_INCOMPLETE = 1024;
protected $path; protected $path;
protected $diffLinesOfContext = 0x7FFF; protected $diffLinesOfContext = 0x7FFF;
@ -110,6 +114,10 @@ abstract class ArcanistRepositoryAPI {
return $this->getWorkingCopyFilesWithMask(self::FLAG_CONFLICT); return $this->getWorkingCopyFilesWithMask(self::FLAG_CONFLICT);
} }
public function getIncompleteChanges() {
return $this->getWorkingCopyFilesWithMask(self::FLAG_INCOMPLETE);
}
private function getWorkingCopyFilesWithMask($mask) { private function getWorkingCopyFilesWithMask($mask) {
$match = array(); $match = array();
foreach ($this->getWorkingCopyStatus() as $file => $flags) { foreach ($this->getWorkingCopyStatus() as $file => $flags) {

View file

@ -125,6 +125,9 @@ class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
case 'conflicted': case 'conflicted':
$mask |= self::FLAG_CONFLICT; $mask |= self::FLAG_CONFLICT;
break; break;
case 'incomplete':
$mask |= self::FLAG_INCOMPLETE;
break;
default: default:
throw new Exception("Unrecognized item status '{$item}'."); throw new Exception("Unrecognized item status '{$item}'.");
} }

View file

@ -319,14 +319,36 @@ class ArcanistBaseWorkflow {
$untracked = $api->getUntrackedChanges(); $untracked = $api->getUntrackedChanges();
if ($this->shouldRequireCleanUntrackedFiles()) { if ($this->shouldRequireCleanUntrackedFiles()) {
if (!empty($untracked)) { if (!empty($untracked)) {
throw new ArcanistUsageException(
"You have untracked files in this working copy:\n". echo "You have untracked files in this working copy:\n\n".
" ".implode("\n ", $untracked)."\n\n". " ".implode("\n ", $untracked)."\n\n";
"Add or delete them before proceeding, or include them in your ".
"ignore rules. To bypass this check, use --allow-untracked."); if ($api instanceof ArcanistGitAPI) {
echo phutil_console_wrap(
"Since you don't have .gitignore rules for these files and have ".
"not listed them in .git/info/exclude, you may have forgotten ".
"to 'git add' them to your commit.");
} else if ($api instanceof ArcanistSubversionAPI) {
echo phutil_console_wrap(
"Since you don't have svn:ignore rules for these files, you may ".
"have forgotten to 'svn add' them.");
}
$prompt = "Do you want to continue without adding these files?";
if (!phutil_console_confirm($prompt, $default_no = false)) {
throw new ArcanistUserAbortException();
}
} }
} }
$incomplete = $api->getIncompleteChanges();
if ($incomplete) {
throw new ArcanistUsageException(
"You have incompletely checked out directories in this working copy. ".
"Fix them before proceeding: \n\n".
" ".implode("\n ", $incomplete)."\n\n".
"You can fix these paths by running 'svn update' on them.");
}
if ($api->getMergeConflicts()) { if ($api->getMergeConflicts()) {
throw new ArcanistUsageException( throw new ArcanistUsageException(

View file

@ -9,6 +9,7 @@
phutil_require_module('arcanist', 'differential/revision'); phutil_require_module('arcanist', 'differential/revision');
phutil_require_module('arcanist', 'exception'); phutil_require_module('arcanist', 'exception');
phutil_require_module('arcanist', 'exception/usage'); phutil_require_module('arcanist', 'exception/usage');
phutil_require_module('arcanist', 'exception/usage/userabort');
phutil_require_module('arcanist', 'parser/bundle'); phutil_require_module('arcanist', 'parser/bundle');
phutil_require_module('arcanist', 'parser/diff'); phutil_require_module('arcanist', 'parser/diff');
phutil_require_module('arcanist', 'parser/diff/change'); phutil_require_module('arcanist', 'parser/diff/change');

View file

@ -203,6 +203,14 @@ EOTEXT
$paths = $this->generateAffectedPaths(); $paths = $this->generateAffectedPaths();
// Do this before we start linting or running unit tests so we can detect
// things like a missing test plan or invalid reviewers immediately.
if ($this->shouldOnlyCreateDiff()) {
$commit_message = null;
} else {
$commit_message = $this->getGitCommitMessage();
}
$lint_result = $this->runLint($paths); $lint_result = $this->runLint($paths);
$unit_result = $this->runUnit($paths); $unit_result = $this->runUnit($paths);
@ -322,7 +330,7 @@ EOTEXT
" **Diff URI:** __%s__\n\n", " **Diff URI:** __%s__\n\n",
$diff_info['uri']); $diff_info['uri']);
} else { } else {
$message = $this->getGitCommitMessage(); $message = $commit_message;
$revision = array( $revision = array(
'diffid' => $diff_info['diffid'], 'diffid' => $diff_info['diffid'],
@ -353,6 +361,15 @@ EOTEXT
} }
$should_edit = $this->getArgument('edit'); $should_edit = $this->getArgument('edit');
/*
TODO: This is a complicated mess. We need to move to storing a checksum
of the non-auto-sync fields as they existed at original diff time and using
changes from that to detect user edits, not comparison of the client and
server values since they diverge without user edits (because of Herald
and explicit server-side user changes).
if (!$should_edit) { if (!$should_edit) {
$local_sum = $message->getChecksum(); $local_sum = $message->getChecksum();
$remote_sum = $remote_message->getChecksum(); $remote_sum = $remote_message->getChecksum();
@ -366,6 +383,7 @@ EOTEXT
$default_no = false); $default_no = false);
} }
} }
*/
$revision['fields'] = $remote_message->getFields(); $revision['fields'] = $remote_message->getFields();