Page MenuHomePhabricator

When saving and restoring local state in Mercurial, also save and restore bookmarks
ClosedPublic

Authored by epriestley on Jul 8 2020, 9:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 16, 1:11 AM
Unknown Object (File)
Jan 16 2024, 3:31 AM
Unknown Object (File)
Dec 27 2023, 1:33 PM
Unknown Object (File)
Dec 27 2023, 1:33 PM
Unknown Object (File)
Dec 27 2023, 1:33 PM
Unknown Object (File)
Dec 27 2023, 1:33 PM
Unknown Object (File)
Dec 25 2023, 10:36 PM
Unknown Object (File)
Dec 22 2023, 3:17 AM
Subscribers
None

Details

Summary

Ref PHI1808. In Mercurial, we must save and restore bookmark state explicitly.

  • Save and restore bookmarks.
  • Clean up concepts in "arc-ls-markers" slightly, so we don't need separate "isCurrent" and "isActive" flags, hopefully.

I believe the totality of Mercurial state is:

  • A (non-bare) working copy points at exactly one commit (which might be the empty/null commit, in an empty repository).
  • A working copy has exactly one active branch.
    • Each branch has zero or more heads.
    • Each head may be closed.
    • Each (non-null) commit belongs to exactly one branch.
    • Note that the active branch may have zero heads and zero commits which belong to it!
  • A working copy has zero or one active bookmark.

To capture this, we now emit:

  • A list of branch heads. If a branch head is a working copy commit, that head is flagged as active.
  • A list of bookmarks. If a bookmark is the current bookmark, that bookmark is flagged as active.
  • A single "branch-state" virtual marker. This covers the case where you have run "hg branch X" to create X, but no objects in the working copy actually correspond to X yet. It also covers the case where you are on a concrete branch, but not any head of that branch.
  • A single "commit-state" virtual marker. This always shows the current commit in the working copy.
Test Plan
  • Useful states to test are:
    • Empty repository (not all commands currently work here).
    • Normal repository, on a bookmark.
    • Normal repository, no bookmark.
    • "hg up 123" to update to somewhere in history.
    • "hg branch X", to start a new branch with no commits.
  • Ran "arc branches" and "arc bookmarks" in various states. Saw generally sensible output.
  • Ran "arc land --hold ..." in various states against a failing remote. Saw generally sensible output, and saw working properly restored to the original state.

Diff Detail

Repository
rARC Arcanist
Branch
hg7
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 24748
Build 34130: Run Core Tests
Build 34129: arc lint + arc unit

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.Jul 8 2020, 10:30 PM
This revision was automatically updated to reflect the committed changes.