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

Implement jj sync command #1039

Open
dbarnett opened this issue Jan 14, 2023 · 18 comments
Open

Implement jj sync command #1039

dbarnett opened this issue Jan 14, 2023 · 18 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers polish🪒🐃 Make existing features more convenient and more consistent

Comments

@dbarnett
Copy link
Collaborator

jj should have a command to sync all of my branches (or some subset) with a remote via merge or rebase, in a single operation.

Since that could cause a lot of big changes at once, it'd be nice to show a preview of changes that will be performed and prompt to confirm and/or output a very clear summary of what all changed from that sync operation.

@dbarnett dbarnett added the enhancement New feature or request label Jan 14, 2023
@dbarnett
Copy link
Collaborator Author

I could also imagine some related curation tools for e.g. moving a local branch to "draft mode" to not be published or synced yet.

@dbarnett
Copy link
Collaborator Author

dbarnett commented Jan 14, 2023

This is also one of the areas jj was dinged in the comparison table at https://blog.waleedkhan.name/git-ui-features/#data.

@MForster
Copy link
Collaborator

IMHO sync is ambiguous about the direction. Does it only pull or also push?

@PhilipMetzger
Copy link
Collaborator

I think jj sync should only pull, like its Perforce predecessor. If that isn't clear enough, we can alias the command for Git users to jj pull

@martinvonz
Copy link
Owner

IMHO sync is ambiguous about the direction. Does it only pull or also push?

Hmm, that's a good point. On the other hand, I don't think we've had any confusion about that at Google with our hg sync command, which does pull+rebase. I'm not sure what a better name would be.

we can alias the command for Git users to jj pull

I think Git's use of "pull" for "fetch+rebase/merge" is quite confusing. I prefer hg's use of hg pull for just pulling (like git fetch). That is more symmetric with hg/git push.

@MForster
Copy link
Collaborator

I don't think we've had any confusion about that at Google with our hg sync command

That's not representative, because ~everybody at Google has used Perforce/Piper.

FWIW, VSCode has a "Sync" button that pulls and pushes...

@martinvonz
Copy link
Owner

That's not representative, because ~everybody at Google has used Perforce/Piper.

True. (I have practically not used it, but I still have run p4 sync several times.)

FWIW, VSCode has a "Sync" button that pulls and pushes...

Oh, that's a good data point!

We'd still have to think of a better name then... There's hg fetch that does this. I don't know if they named it that as a joke, given that it means that hg pull == git fetch and hg fetch == git pull. So I don't really think we should call it jj fetch.

@PhilipMetzger
Copy link
Collaborator

IMHO, jj sync should be good enough. We then should mention, that it's inspired by Perforce's p4 sync. If we then want to accommodate Mercurial and Git users, we can alias it to their equivalent.
I think we should approach Editor integration with our own tools and assumptions and disregard the current state for Git and Mercurial.

@dbarnett
Copy link
Collaborator Author

Graphite also uses "sync" to refer to this same kind of "pull-and-restack" operation: https://docs.graphite.dev/guides/graphite-cli/syncing-and-resolving-conflicts

Do we envision jj ever would support that kind of bidirectional "pull + push"? If so, maybe we have a command called sync that defaults to --in mode with eventual support for --in-out mode, or something like that? (Hard for me to imagine wanting such a shotgun command though, personally.)

@Ralith
Copy link
Collaborator

Ralith commented Jan 16, 2023

That's not representative, because ~everybody at Google has used Perforce/Piper.

I skipped Piper and went straight to Fig, and found hg sync to be plenty intuitive. Agreed that doing both at once seems weird and error-prone.

@ilyagr
Copy link
Collaborator

ilyagr commented Feb 20, 2023

Now that #1288 is in, you can get part of the way to jj sync with a command like jj rebase -s oldmain+~:main -d main -L. This is, of course, not particularly pretty and requires finding the oldmain commit.

Another, simpler, alternative if you're OK with rebasing everything not on main: jj rebase -s roots(main..) -d main.

@PhilipMetzger PhilipMetzger added the polish🪒🐃 Make existing features more convenient and more consistent label Sep 28, 2023
@PhilipMetzger
Copy link
Collaborator

PhilipMetzger commented Sep 28, 2023

We discussed jj sync multiple times in the recent months in Discord as there is one big issue to solve: backend independence.

Summary:
Ideally jj sync should be a un-namespaced command (without a backend prefix) but this makes it difficult to determine which implementation to use. @martinvonz's suggestion in an internal chat and on Discord was to make the command forge specific, e.g jj git sync, jj gerrit sync or jj piper sync and then allow the unnamespaced sync command to wrap it. This means that for the most users, jj sync would be jj git sync. Another option is to make that a buiiltin alias for each backend.

While I was initially sceptical of the namespaced approach, I now think it is the right solution for this problem. The only issue I see, if we take the forge-specific approach, is that some layering issue may pop up. But if we implement something like jj submit or jj mail, a forge trait is needed anyway.

@martinvonz martinvonz added the good first issue Good for newcomers label Nov 13, 2023
@martinvonz martinvonz self-assigned this Jan 22, 2024
@essiene essiene self-assigned this Oct 14, 2024
essiene added a commit that referenced this issue Nov 4, 2024
We will need this in the `jj git sync` command to perform a fetch that behaves
the same as the `jj git fetch` command.

Fetch extract the function in this commit, so diffs are easier to review.

A later commit will move this function (and associated functions) out to cli/src/git_util.rs

Part of: #1039
essiene added a commit that referenced this issue Nov 4, 2024
We will need this in the `jj git sync` command to perform a fetch that behaves
the same as the `jj git fetch` command.

Fetch extract the function in this commit, so diffs are easier to review.

A later commit will move this function (and associated functions) out to cli/src/git_util.rs

Part of: #1039
essiene added a commit that referenced this issue Nov 4, 2024
We will need this in the `jj git sync` command to perform a fetch that behaves
the same as the `jj git fetch` command.

Part of: #1039
essiene added a commit that referenced this issue Nov 19, 2024
* map old heads -> new heads
* rebase
  * roots are candidates with parents with updated heads.
  * simplify parent merge
  * drop newly emptied commits
  * update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.


Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
* map old heads -> new heads
* rebase
  * roots are candidates with parents with updated heads.
  * simplify parent merge
  * drop newly emptied commits
  * update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [ ] Rebase
  * [X] Build old -> new map
  * [ ] transform descendants


## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [ ] Rebase
  * [X] Build old -> new map
  * [ ] transform descendants


## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 19, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 23, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants


## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG

Issue: #1039
essiene added a commit that referenced this issue Nov 23, 2024
Similarly to `git_fetch`, this will be used in `jj git sync`, so
moving this out to maintain the same behaviour across `fetch` command and `sync`.

* Refactor out `get_fetch_remotes` to `git_util.rs`.
* inline the different `get_*_remote*` functions into `get_fetch_remotes`;
  The resulting function is still small enough to be easily readable.
* Move `get_single_remote` into `git_util.rs` and update call sites.
* Use common FetchArgs to pass arguments both to `get_fetch_remotes` and `git_fetch`
* Update use references

All tests still pass.

Issue: #1039
essiene added a commit that referenced this issue Nov 23, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants

# git sync: Setup scaffolding
## Details
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.
* Set up some tracing guards which will help debugging when run with --debug.


# git sync: Get branch heads and fetch from remote.
## Details
* For branch heads, we grab local branches matching the pattern
  specified in args.
* Pre-fetch heads query tx.base_repo() while post-fetch heads
  query tx.repo(); tx.repo() is the in memory Mutable repo which
  is updated after a fetch in a transaction.
* We fetch from all branches from all configured remotes.
  --all_remotes affects if we use `git.fetch` or all repo remotes.

# git sync: Build candidate commits.
## Details
* Candidate commits (parent_id, child_id) are:
    * branch commits
    * and their descendants
    * which are not found in untracked remote branches

# git sync: Build update record
## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.


# git sync: unhide `jj git sync`
## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG


# git sync: Rebase commits onto new branch heads.
## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Nov 23, 2024
Similarly to `git_fetch`, this will be used in `jj git sync`, so
moving this out to maintain the same behaviour across `fetch` command and `sync`.

* Refactor out `get_fetch_remotes` to `git_util.rs`.
* inline the different `get_*_remote*` functions into `get_fetch_remotes`;
  The resulting function is still small enough to be easily readable.
* Move `get_single_remote` into `git_util.rs` and update call sites.
* Use common FetchArgs to pass arguments both to `get_fetch_remotes` and `git_fetch`
* Update use references

All tests still pass.

Issue: #1039
essiene added a commit that referenced this issue Nov 23, 2024
Similarly to `git_fetch`, this will be used in `jj git sync`, so
moving this out to maintain the same behaviour across `fetch` command and `sync`.

* Refactor out `get_fetch_remotes` to `git_util.rs`.
* inline the different `get_*_remote*` functions into `get_fetch_remotes`;
  The resulting function is still small enough to be easily readable.
* Move `get_single_remote` into `git_util.rs` and update call sites.
* Use common FetchArgs to pass arguments both to `get_fetch_remotes` and `git_fetch`
* Update use references

All tests still pass.

Issue: #1039
essiene added a commit that referenced this issue Nov 23, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants

# git sync: Setup scaffolding
## Details
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.
* Set up some tracing guards which will help debugging when run with --debug.


# git sync: Get branch heads and fetch from remote.
## Details
* For branch heads, we grab local branches matching the pattern
  specified in args.
* Pre-fetch heads query tx.base_repo() while post-fetch heads
  query tx.repo(); tx.repo() is the in memory Mutable repo which
  is updated after a fetch in a transaction.
* We fetch from all branches from all configured remotes.
  --all_remotes affects if we use `git.fetch` or all repo remotes.

# git sync: Build candidate commits.
## Details
* Candidate commits (parent_id, child_id) are:
    * branch commits
    * and their descendants
    * which are not found in untracked remote branches

# git sync: Build update record
## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.


# git sync: unhide `jj git sync`
## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG


# git sync: Rebase commits onto new branch heads.
## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Nov 24, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants

# git sync: Setup scaffolding
## Details
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.
* Set up some tracing guards which will help debugging when run with --debug.


# git sync: Get branch heads and fetch from remote.
## Details
* For branch heads, we grab local branches matching the pattern
  specified in args.
* Pre-fetch heads query tx.base_repo() while post-fetch heads
  query tx.repo(); tx.repo() is the in memory Mutable repo which
  is updated after a fetch in a transaction.
* We fetch from all branches from all configured remotes.
  --all_remotes affects if we use `git.fetch` or all repo remotes.

# git sync: Build candidate commits.
## Details
* Candidate commits (parent_id, child_id) are:
    * branch commits
    * and their descendants
    * which are not found in untracked remote branches

# git sync: Build update record
## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.


# git sync: unhide `jj git sync`
## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG


# git sync: Rebase commits onto new branch heads.
## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Nov 24, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants

# git sync: Setup scaffolding
## Details
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.
* Set up some tracing guards which will help debugging when run with --debug.


# git sync: Get branch heads and fetch from remote.
## Details
* For branch heads, we grab local branches matching the pattern
  specified in args.
* Pre-fetch heads query tx.base_repo() while post-fetch heads
  query tx.repo(); tx.repo() is the in memory Mutable repo which
  is updated after a fetch in a transaction.
* We fetch from all branches from all configured remotes.
  --all_remotes affects if we use `git.fetch` or all repo remotes.

# git sync: Build candidate commits.
## Details
* Candidate commits (parent_id, child_id) are:
    * branch commits
    * and their descendants
    * which are not found in untracked remote branches

# git sync: Build update record
## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.


# git sync: unhide `jj git sync`
## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG


# git sync: Rebase commits onto new branch heads.
## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Nov 24, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants

# git sync: Setup scaffolding
## Details
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.
* Set up some tracing guards which will help debugging when run with --debug.


# git sync: Get branch heads and fetch from remote.
## Details
* For branch heads, we grab local branches matching the pattern
  specified in args.
* Pre-fetch heads query tx.base_repo() while post-fetch heads
  query tx.repo(); tx.repo() is the in memory Mutable repo which
  is updated after a fetch in a transaction.
* We fetch from all branches from all configured remotes.
  --all_remotes affects if we use `git.fetch` or all repo remotes.

# git sync: Build candidate commits.
## Details
* Candidate commits (parent_id, child_id) are:
    * branch commits
    * and their descendants
    * which are not found in untracked remote branches

# git sync: Build update record
## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.


# git sync: unhide `jj git sync`
## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG


# git sync: Rebase commits onto new branch heads.
## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Dec 3, 2024
Similarly to `git_fetch`, this will be used in `jj git sync`, so
moving this out to maintain the same behaviour across `fetch` command and `sync`.

* Refactor out `get_fetch_remotes` to `git_util.rs`.
* inline the different `get_*_remote*` functions into `get_fetch_remotes`;
  The resulting function is still small enough to be easily readable.
* Move `get_single_remote` into `git_util.rs` and update call sites.
* Use common FetchArgs to pass arguments both to `get_fetch_remotes` and `git_fetch`
* Update use references

All tests still pass.

Issue: #1039
essiene added a commit that referenced this issue Dec 3, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants

# git sync: Setup scaffolding
## Details
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.
* Set up some tracing guards which will help debugging when run with --debug.


# git sync: Get branch heads and fetch from remote.
## Details
* For branch heads, we grab local branches matching the pattern
  specified in args.
* Pre-fetch heads query tx.base_repo() while post-fetch heads
  query tx.repo(); tx.repo() is the in memory Mutable repo which
  is updated after a fetch in a transaction.
* We fetch from all branches from all configured remotes.
  --all_remotes affects if we use `git.fetch` or all repo remotes.

# git sync: Build candidate commits.
## Details
* Candidate commits (parent_id, child_id) are:
    * branch commits
    * and their descendants
    * which are not found in untracked remote branches

# git sync: Build update record
## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.


# git sync: unhide `jj git sync`
## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG


# git sync: Rebase commits onto new branch heads.
## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
essiene added a commit that referenced this issue Dec 8, 2024
## Summary
* [X] Get branch pre-fetch heads
* [X] Build candidates from prefetch heads
* [X] Fetch from remotes
* [X] Get branch post-fetch heads
* [X] Rebase
  * [X] Build old -> new map
  * [X] transform descendants

# git sync: Setup scaffolding
## Details
* First commit that just sets up scaffolding.
* `jj git sync` is hidden as it's not yet ready.
* Set up some tracing guards which will help debugging when run with --debug.


# git sync: Get branch heads and fetch from remote.
## Details
* For branch heads, we grab local branches matching the pattern
  specified in args.
* Pre-fetch heads query tx.base_repo() while post-fetch heads
  query tx.repo(); tx.repo() is the in memory Mutable repo which
  is updated after a fetch in a transaction.
* We fetch from all branches from all configured remotes.
  --all_remotes affects if we use `git.fetch` or all repo remotes.

# git sync: Build candidate commits.
## Details
* Candidate commits (parent_id, child_id) are:
    * branch commits
    * and their descendants
    * which are not found in untracked remote branches

# git sync: Build update record
## Details
Build a record of old branch heads mapped to the new branch heads.
This record will be used to derive the candidates that need
rebasing.


# git sync: unhide `jj git sync`
## Details
* Add tests
* Unhide the command, now that it's complete.
* Update CHANGELOG


# git sync: Rebase commits onto new branch heads.
## Details
* implement CommitRewritter::repo() to return an immutable reference.
* transform_descendants() roots are candidates with parents in update_record.
* simplify parent merge
* drop newly emptied commits
* update new parents from the updated heads set if the old parents are ancestors.

Issue: #1039
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers polish🪒🐃 Make existing features more convenient and more consistent
Projects
None yet
Development

No branches or pull requests

9 participants