Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pull.without-history work for Share project branches #4301

Merged
merged 8 commits into from
Sep 8, 2023

Conversation

ChrisPenner
Copy link
Contributor

@ChrisPenner ChrisPenner commented Aug 31, 2023

Overview

Pulling without history (i.e. a squashed version of a branch) is handy when you just need the code, but won't be contributing back. E.g. installing an executable.

Typically users will simply pull a release, which are already squashed, but the cloud team has requested the ability to do this with their main branch to speed up CI significantly.

This makes pull.without-history use a server-side squash rather than a local squash after pull so we can get away with pulling significantly less data and speed things up. Currently this is implemented only for project branches, not loose-code.

Merge and deploy the server side first:
See server-side: https://github.com/unisoncomputing/enlil/pull/322

myproj/main> history

  Note: The most recent namespace hash is immediately below this message.

  ⊙ 1. #jgeoqlvtoe

    + Adds / updates:

      x1 y

    = Copies:

      Original name New name(s)
      x3            x1

  ⊙ 2. #5kefseq9bm

    > Moves:

      Original name New name
      x2            x3

  ⊙ 3. #s88t06ld0p

    > Moves:

      Original name New name
      x1            x2

  ⊙ 4. #du8rbf12ei

    + Adds / updates:

      x1

  □ 5. #9gvcfnpaj2 (start of history)

myproj/main> push @test/myproj

  @test/myproj/main on http://localhost:5424 is already up-to-date.

myproj/main> cd .
.> pull.without-history @test/myproj squashed

  ✅

  Successfully updated squashed from @test/myproj/main.

.> cd squashed
.squashed> history

  Note: The most recent namespace hash is immediately below this message.



  □ 1. #ar8hiee861 (start of history)

.squashed> ls

  1. builtin/ (622 terms, 88 types)
  2. x1       (Nat)
  3. x3       (Nat)
  4. y        (Nat)

.squashed>

Implementation notes

When running pull.without-history to pull a remote branch, use the new includeSquashed flag to ask Share to include the squashed causal hash in the response (and to ensure it's available to download). Then use that squashed hash when downloading instead of the branch head.

Interesting/controversial decisions

Optionally this could've been a new endpoint, but I think it's both sensible and simple to adapt the existing get branch endpoint.

Note: The squashed causal hash is always included on release downloads since those are already squashed, but it's the same as the branch-head in that case.

Test coverage

See the UCM session captured above.

Loose ends

Need to deploy the Share side before merging this.

@ChrisPenner ChrisPenner changed the title Cp/squashed pull Make pull.without-history work for Share project branches Aug 31, 2023
@ChrisPenner ChrisPenner marked this pull request as ready for review August 31, 2023 21:52
@ChrisPenner ChrisPenner self-assigned this Aug 31, 2023
@ChrisPenner
Copy link
Contributor Author

Looks like at least one of the transcripts does a pull.without-history and is failing because the share portion hasn't been deployed yet. Just a good reminder to deploy the share part first, then that should clear up 😄

@ChrisPenner ChrisPenner merged commit df45830 into trunk Sep 8, 2023
6 checks passed
@ChrisPenner ChrisPenner deleted the cp/squashed-pull branch September 8, 2023 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants