mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
repo: update working copy to first divergent commit
This commit is contained in:
parent
d2043f069e
commit
890a8e282f
2 changed files with 6 additions and 9 deletions
|
@ -732,7 +732,7 @@ pub struct MutableRepo {
|
|||
base_repo: Arc<ReadonlyRepo>,
|
||||
index: Box<dyn MutableIndex>,
|
||||
view: DirtyCell<View>,
|
||||
rewritten_commits: HashMap<CommitId, HashSet<CommitId>>,
|
||||
rewritten_commits: HashMap<CommitId, Vec<CommitId>>,
|
||||
abandoned_commits: HashSet<CommitId>,
|
||||
}
|
||||
|
||||
|
@ -816,18 +816,16 @@ impl MutableRepo {
|
|||
/// docstring for `record_rewritten_commit` for details.
|
||||
pub fn set_rewritten_commit(&mut self, old_id: CommitId, new_id: CommitId) {
|
||||
assert_ne!(old_id, *self.store().root_commit_id());
|
||||
self.rewritten_commits
|
||||
.insert(old_id, std::iter::once(new_id).collect());
|
||||
self.rewritten_commits.insert(old_id, vec![new_id]);
|
||||
}
|
||||
|
||||
/// Record a commit as being rewritten into multiple other commits in this
|
||||
/// transaction.
|
||||
///
|
||||
/// A later call to `rebase_descendants()` will update branches pointing to
|
||||
/// `old_id` be conflicted and pointing to all pf `new_ids`. Working
|
||||
/// copies pointing to `old_id` will be updated to point to an arbitrary
|
||||
/// commit in `new_ids` (TODO: make it point to the first one). Descendants
|
||||
/// of `old_id` will be left alone.
|
||||
/// `old_id` be conflicted and pointing to all pf `new_ids`. Working copies
|
||||
/// pointing to `old_id` will be updated to point to the first commit in
|
||||
/// `new_ids``. Descendants of `old_id` will be left alone.
|
||||
pub fn set_divergent_rewrite(
|
||||
&mut self,
|
||||
old_id: CommitId,
|
||||
|
|
|
@ -313,7 +313,7 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
|
|||
pub fn new(
|
||||
settings: &'settings UserSettings,
|
||||
mut_repo: &'repo mut MutableRepo,
|
||||
rewritten: HashMap<CommitId, HashSet<CommitId>>,
|
||||
rewritten: HashMap<CommitId, Vec<CommitId>>,
|
||||
abandoned: HashSet<CommitId>,
|
||||
) -> DescendantRebaser<'settings, 'repo> {
|
||||
let store = mut_repo.store();
|
||||
|
@ -372,7 +372,6 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
|
|||
if new_commits.len() == 1 {
|
||||
parent_mapping.insert(old_commit, vec![new_commits.into_iter().next().unwrap()]);
|
||||
} else {
|
||||
// The call to index.heads() is mostly to get a predictable order
|
||||
let new_commits = mut_repo.index().heads(&mut new_commits.iter());
|
||||
parent_mapping.insert(old_commit.clone(), new_commits);
|
||||
divergent.insert(old_commit);
|
||||
|
|
Loading…
Reference in a new issue