1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-01-22 20:51:09 +01:00
phorge-arcanist/src
epriestley 0e27dbfd17 Refactor getWorkingCopyStatus() into getUncommittedStatus() and getCommitRangeStatus()
Summary:
See discussion in D4049.

The getWorkingCopyStatus() method gets called from requireCleanWorkingCopy() in a lot of places, which triggers resolution of the base of the commit range. This is unnecessary; we do not need to examine the base commit in order to determine whether the working copy is dirty or not. This causes problems, in D4049 and elsewhere (we currently have a lot of fluff calls to setDefaultBaseCommit() in workflows which need to call requireCleanWorkingCopy() but do not ever use commit ranges, such as `arc patch`). This is mostly an artifact of SVN, where the "commit range" and "uncommitted stuff in the working copy" are always the same.

  - Split the method into two status methods: getUncommittedStatus() (uncommitted stuff in the working copy, required by requireCleanWorkingCopy()) and getCommitRangeStatus() (committed stuff in the commit range).
  - Lift caching out of the implementations into the base class.
  - Dirty the cache after we commit.

This doesn't do anything useful on its own and creates one caching problem (`commitRangeStatusCache` is not invalidated when the commit range changes because of `setBaseCommit()` or similar) but I wanted to break things apart here. I won't land it until there's a more complete picture.

This creates a minor performance regression in git and hg (we run less stuff in parallel than previously) but all the commands should be disk-bound anyway and the regression should be minor. It prevents a larger regression in `hg` in D4049, and lets us do less work to arrive at common error states (dirty working copy). We can examine perf at the end of this change sequence.

Test Plan: Ran unit tests, various `arc` commands.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D4095
2012-12-17 12:53:28 -08:00
..
configuration Add arc browse workflow 2012-12-09 14:10:21 -08:00
difference Fix some arcanist warnings 2012-11-21 17:16:52 -08:00
differential Delete license headers from files 2012-11-05 11:16:24 -08:00
docs Make the "this is technical documentation" message of "Arcanist Overview" more clear 2012-08-10 11:37:30 -07:00
events/constant Delete license headers from files 2012-11-05 11:16:24 -08:00
exception Delete license headers from files 2012-11-05 11:16:24 -08:00
hgdaemon Delete license headers from files 2012-11-05 11:16:24 -08:00
infrastructure/testing Delete license headers from files 2012-11-05 11:16:24 -08:00
lint Update PEP8 2012-12-14 17:50:18 -08:00
parser Introduce arc lint --only-new 1 2012-12-03 17:21:17 -08:00
repository Refactor getWorkingCopyStatus() into getUncommittedStatus() and getCommitRangeStatus() 2012-12-17 12:53:28 -08:00
unit Change lint_engine to lint.engine 2012-11-20 15:42:35 -08:00
workflow Suggest upgrading Phabricator for unknown Conduit methods or parameters 2012-12-14 18:16:01 -08:00
workingcopyidentity Delete license headers from files 2012-11-05 11:16:24 -08:00
__phutil_library_init__.php Delete license headers from files 2012-11-05 11:16:24 -08:00
__phutil_library_map__.php Refactor getWorkingCopyStatus() into getUncommittedStatus() and getCommitRangeStatus() 2012-12-17 12:53:28 -08:00