Page MenuHomePhabricator

Fix working copy binding powers in weird edge cases
ClosedPublic

Authored by epriestley on Dec 3 2013, 1:41 AM.
Tags
None
Referenced Files
F14003380: D7686.id17355.diff
Sat, Oct 26, 5:38 AM
F13991695: D7686.id.diff
Tue, Oct 22, 12:10 PM
F13974205: D7686.diff
Fri, Oct 18, 4:32 AM
Unknown Object (File)
Oct 11 2024, 5:36 AM
Unknown Object (File)
Sep 21 2024, 9:52 AM
Unknown Object (File)
Sep 5 2024, 1:51 AM
Unknown Object (File)
Sep 4 2024, 5:06 AM
Unknown Object (File)
Sep 3 2024, 12:23 AM
Subscribers

Details

Reviewers
btrahan
Maniphest Tasks
Restricted Maniphest Task
Commits
rARC4fdb87761bce: Fix working copy binding powers in weird edge cases
Summary

Fixes T1277. The rules we use to figure out the root of the working copy get a bunch of edge cases wrong right now. A particularly troublesome one is when a user has a /.arcconfig or /home/.arcconfig or similar, which raises a completely useless and confusing error message (T1277).

Rewrite these rules to get all the edge cases correct and do reasonable things in the presence of stray .arcconfig. There are a bunch of comments, but basically the algorithm is:

  • From the top, go down one directory at a time until we find ".svn", ".git", or ".hg".
  • In Subversion, keep going down looking for ".arcconfig". In Git and Mercurial, look for ".arcconfig" only in the same directory.
  • Now that we've figured out the VCS root (where the ".vcs" directory is) and the project root (where the ".arcconfig" file is, if it exists), build an identity.

This logic was also spread across three different places. Consolidate it into one and add some logging so we can figure out what's going wrong if users run into trouble.

Test Plan
  • Ran VCS (arc list) and non-VCS (arc help) commands in Git, Mercurial, and Subversions roots and subdirectories. Also ran them in non-VCS directories. Ran them with and without .arcconfig. All the outputs seemed completely reasonable.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

btrahan added inline comments.
src/workingcopyidentity/ArcanistWorkingCopyIdentity.php
54–55

'tis a noble attempt

166–169

this works? (in class A, you can instantiate an instance of class A and set private member variables directly?)

src/workingcopyidentity/ArcanistWorkingCopyIdentity.php
166–169

Yep. It maybe "shouldn't", but that's how PHP works, at least. Effectively, "private" means "private to the class", not "private to the instance".