Skip to content
Permalink
Browse files
Make all the working-copy-paths errors extremely explicit.
  • Loading branch information
epriestley committed Mar 13, 2011
1 parent 982e482 commit 628de7d7a15cd7b5737515ec2831b3b4c3f601a5
@@ -50,6 +50,7 @@
'ArcanistNoEffectException' => 'exception/usage/noeffect',
'ArcanistNoEngineException' => 'exception/usage/noengine',
'ArcanistNoLintLinter' => 'lint/linter/nolint',
'ArcanistNoLintTestCaseMisnamed' => 'lint/linter/nolint/__tests__',
'ArcanistPEP8Linter' => 'lint/linter/pep8',
'ArcanistPatchWorkflow' => 'workflow/patch',
'ArcanistPhutilModuleLinter' => 'lint/linter/phutilmodule',
@@ -100,6 +101,7 @@
'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException',
'ArcanistNoLintLinter' => 'ArcanistLinter',
'ArcanistNoLintTestCaseMisnamed' => 'ArcanistLinterTestCase',
'ArcanistPEP8Linter' => 'ArcanistLinter',
'ArcanistPatchWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistPhutilModuleLinter' => 'ArcanistLinter',
@@ -182,6 +182,9 @@ public function getWorkingCopyStatus() {
}
}

// TODO: This doesn't list unstaged adds. It's not clear how to get that
// list other than "git status --porcelain" and then parsing it. :/

This comment has been minimized.

Copy link
@artagnon

artagnon Nov 22, 2013

Contributor

What exactly is an "unstaged add"? The next statement git ls-files -m finds the unstaged changes.

This comment has been minimized.

Copy link
@epriestley

epriestley Nov 22, 2013

Member

I'm not sure what I meant -- this might refer to new files which haven't been added with git add, as they aren't listed in ls-files -m but are listed in git status --porcelain. If so, the comment is incorrect since they get picked up earlier by git diff --raw .... This TODO can probably be removed safely.

This comment has been minimized.

Copy link
@artagnon

artagnon Nov 22, 2013

Contributor

New files that haven't been added with git add are referred to as "untracked files"; we don't even try to collect a list of untracked files here. Opened PR #119.

This comment has been minimized.

Copy link
@epriestley

epriestley Nov 22, 2013

Member

Line 173 in this file finds untracked files:

// Find untracked files.

This comment has been minimized.

Copy link
@artagnon

artagnon Nov 22, 2013

Contributor

Oh, okay. I thought the comment was intended for the next statement: git ls-files -m. Either way, it's bogus, right?

This comment has been minimized.

Copy link
@epriestley

epriestley Nov 22, 2013

Member

Oh, sorry:

Earlier, we list untracked files.

Here, we list unstaged changes.

The comment is referring to "ls-files -m", but doesn't make any sense. I probably ran "ls-files -m" in isolation, saw it didn't include untracked files, got confused about the overall behavior of the program, and made a mistake.


// Find unstaged changes.
list($stdout) = execx(
'(cd %s; git ls-files -m)',
@@ -316,21 +316,26 @@ protected function shouldRequireCleanUntrackedFiles() {
protected function requireCleanWorkingCopy() {
$api = $this->getRepositoryAPI();

$working_copy_desc = phutil_console_format(
" Working copy: __%s__\n\n",
$api->getPath());

$untracked = $api->getUntrackedChanges();
if ($this->shouldRequireCleanUntrackedFiles()) {
if (!empty($untracked)) {

echo "You have untracked files in this working copy:\n\n".
echo "You have untracked files in this working copy.\n\n".
$working_copy_desc.
" Untracked files in working copy:\n".
" ".implode("\n ", $untracked)."\n\n";

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 ".
"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 ".
"Since you don't have 'svn:ignore' rules for these files, you may ".
"have forgotten to 'svn add' them.");
}

@@ -345,27 +350,41 @@ protected function requireCleanWorkingCopy() {
if ($incomplete) {
throw new ArcanistUsageException(
"You have incompletely checked out directories in this working copy. ".
"Fix them before proceeding: \n\n".
"Fix them before proceeding.\n\n".
$working_copy_desc.
" Incomplete directories in working copy:\n".
" ".implode("\n ", $incomplete)."\n\n".
"You can fix these paths by running 'svn update' on them.");
}

if ($api->getMergeConflicts()) {
$conflicts = $api->getMergeConflicts();
if ($conflicts) {
throw new ArcanistUsageException(
"You have merge conflicts in this working copy. Resolve merge ".
"conflicts before proceeding.");
"conflicts before proceeding.\n\n".
$working_copy_desc.
" Conflicts in working copy:\n".
" ".implode("\n ", $conflicts)."\n");
}

if ($api->getUnstagedChanges()) {
$unstaged = $api->getUnstagedChanges();
if ($unstaged) {
throw new ArcanistUsageException(
"You have unstaged changes in this branch. Stage and commit (or ".
"revert) them before proceeding.");
"You have unstaged changes in this working copy. Stage and commit (or ".
"revert) them before proceeding.\n\n".
$working_copy_desc.
" Unstaged changes in working copy:\n".
" ".implode("\n ", $unstaged)."\n");
}

if ($api->getUncommittedChanges()) {
$uncommitted = $api->getUncommittedChanges();
if ($uncommitted) {
throw new ArcanistUsageException(
"You have uncommitted changes in this branch. Commit (or revert) them ".
"before proceeding.");
"before proceeding.\n\n".
$working_copy_desc.
" Uncommitted changes in working copy\n".
" ".implode("\n ", $uncommitted)."\n");
}
}

0 comments on commit 628de7d

Please sign in to comment.