]> khamidou — GitHub mirrors - arcanist.git/commit
Refactor commit ranges and base commit handling
authorepriestley <git@epriestley.com>
Mon, 17 Dec 2012 20:54:08 +0000 (12:54 -0800)
committerepriestley <git@epriestley.com>
Mon, 17 Dec 2012 20:54:08 +0000 (12:54 -0800)
commit0bf5c3603c9b2eeda1f96399cbcc6957cbad72cf
treecb8eeb1b55e91dca350478e1de4ef2d5bb59efed
parent2ae0cb797da57fbfd940671fef612b4d1edbd0fe
Refactor commit ranges and base commit handling

Summary:
See D4049, D4096.

  - Move commit range storage from Mercurial and Git APIs to the base API.
  - Move caching up to the base level.
    - Store symbolic name and resolved name separately, so we can re-resolve the correct commit from the symbolic name after dirtying caches.
  - Rename `supportsRelativeLocalCommit()` to `supportsCommitRanges()` (old name wasn't very good, and not consistent with new terminology like the `--base` flag).
  - Rename `getRelativeCommit()` and `setRelativeCommit()` to `getBaseCommit()` and `setBaseCommit()`.
  - Introduce `reloadCommitRange()` and call it from `reloadWorkingCopy()`.

I think this fixes the problem in D4049, and provides a general solution for the class of problems we're running into here, with D4096. Specifically:

  - We no longer get dirty caches, as long as you call reloadWorkingCopy() after changing the working copy (or call a method which calls it for you).
  - We no longer get order-of-parsing-things problems, because setBaseCommit() reloads the appropriate caches.
  - We no longer get nasty effects from calling `requireCleanWorkingCopy()` too early.

Test Plan: This is pretty far-reaching and hard to test. Unit tests; ran various arc commands. :/

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4097
12 files changed:
src/repository/api/ArcanistGitAPI.php
src/repository/api/ArcanistMercurialAPI.php
src/repository/api/ArcanistRepositoryAPI.php
src/repository/api/ArcanistSubversionAPI.php
src/workflow/ArcanistBaseWorkflow.php
src/workflow/ArcanistCoverWorkflow.php
src/workflow/ArcanistDiffWorkflow.php
src/workflow/ArcanistExportWorkflow.php
src/workflow/ArcanistLandWorkflow.php
src/workflow/ArcanistLintWorkflow.php
src/workflow/ArcanistPatchWorkflow.php
src/workflow/ArcanistWhichWorkflow.php