mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
5346a46bb5
Summary: Backports: ``` # HG changeset patch # User Martin von Zweigbergk <martinvonz@google.com> # Date 1521175251 25200 # Thu Mar 15 21:40:51 2018 -0700 # Branch stable # Node ID a046d6890761b6a99475f0e5bf9cce74715897ec # Parent b9a6ee2066f9636265d812a3a8b82b02bc3223aa rebase: avoid defining two lists with the same contents In abort(), there's "dstates" and "rebased" that are identical, which they seem to have been since 0806823370d8 (rebase: properly calculate descendant set when aborting (issue3332), 2012-03-22). Let's de-duplicate. I don't know what "dstates" means, but "rebased" makes sense (it's the list of rebased revisions), so let's pick that. Differential Revision: https://phab.mercurial-scm.org/D2878 # HG changeset patch # User Martin von Zweigbergk <martinvonz@google.com> # Date 1521178507 25200 # Thu Mar 15 22:35:07 2018 -0700 # Branch stable # Node ID 177f3b90335fc49c23a8880de57dc865f0832849 # Parent a046d6890761b6a99475f0e5bf9cce74715897ec rebase: on abort, don't strip commits that didn't need rebased (issue5822) I clearly missed adding this condition in 78496ac30025 (rebase: allow rebase even if some revisions need no rebase (BC) (issue5422), 2017-05-11). Perhaps I should have opted for the "revdone" solution I mentioned there... Differential Revision: https://phab.mercurial-scm.org/D2879 ``` Differential Revision: D7517675 fbshipit-source-id: c08206700f2a26a36785adf9df93176449a58376
122 lines
2.3 KiB
Perl
122 lines
2.3 KiB
Perl
Tests rebasing with part of the rebase set already in the
|
|
destination (issue5422)
|
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
> [extensions]
|
|
> rebase=
|
|
>
|
|
> [experimental]
|
|
> evolution.createmarkers=True
|
|
> evolution.allowunstable=True
|
|
>
|
|
> [alias]
|
|
> tglog = log -G --template "{rev}: {node|short} {desc}"
|
|
> EOF
|
|
|
|
$ rebasewithdag() {
|
|
> N=`$PYTHON -c "print($N+1)"`
|
|
> hg init repo$N && cd repo$N
|
|
> hg debugdrawdag
|
|
> hg rebase "$@" > _rebasetmp
|
|
> r=$?
|
|
> grep -v 'saved backup bundle' _rebasetmp
|
|
> [ $r -eq 0 ] && hg tglog
|
|
> cd ..
|
|
> return $r
|
|
> }
|
|
|
|
Rebase two commits, of which one is already in the right place
|
|
|
|
$ rebasewithdag -r C+D -d B <<EOF
|
|
> C
|
|
> |
|
|
> B D
|
|
> |/
|
|
> A
|
|
> EOF
|
|
rebasing 2:b18e25de2cf5 "D" (D)
|
|
already rebased 3:26805aba1e60 "C" (C tip)
|
|
o 4: fe3b4c6498fa D
|
|
|
|
|
| o 3: 26805aba1e60 C
|
|
|/
|
|
| x 2: b18e25de2cf5 D
|
|
| |
|
|
o | 1: 112478962961 B
|
|
|/
|
|
o 0: 426bada5c675 A
|
|
|
|
Can collapse commits even if one is already in the right place
|
|
|
|
$ rebasewithdag --collapse -r C+D -d B <<EOF
|
|
> C
|
|
> |
|
|
> B D
|
|
> |/
|
|
> A
|
|
> EOF
|
|
rebasing 2:b18e25de2cf5 "D" (D)
|
|
rebasing 3:26805aba1e60 "C" (C tip)
|
|
o 4: a2493f4ace65 Collapsed revision
|
|
| * D
|
|
| * C
|
|
| x 3: 26805aba1e60 C
|
|
|/
|
|
| x 2: b18e25de2cf5 D
|
|
| |
|
|
o | 1: 112478962961 B
|
|
|/
|
|
o 0: 426bada5c675 A
|
|
|
|
Rebase with "holes". The commits after the hole should end up on the parent of
|
|
the hole (B below), not on top of the destination (A).
|
|
|
|
$ rebasewithdag -r B+D -d A <<EOF
|
|
> D
|
|
> |
|
|
> C
|
|
> |
|
|
> B
|
|
> |
|
|
> A
|
|
> EOF
|
|
already rebased 1:112478962961 "B" (B)
|
|
rebasing 3:f585351a92f8 "D" (D tip)
|
|
o 4: 1e6da8103bc7 D
|
|
|
|
|
| x 3: f585351a92f8 D
|
|
| |
|
|
| o 2: 26805aba1e60 C
|
|
|/
|
|
o 1: 112478962961 B
|
|
|
|
|
o 0: 426bada5c675 A
|
|
|
|
Abort doesn't lose the commits that were already in the right place
|
|
|
|
$ newrepo abort
|
|
$ hg debugdrawdag <<EOF
|
|
> C
|
|
> |
|
|
> B D # B/file = B
|
|
> |/ # D/file = D
|
|
> A
|
|
> EOF
|
|
$ hg rebase -r C+D -d B
|
|
rebasing 2:ef8c0fe0897b "D" (D)
|
|
merging file
|
|
warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
[1]
|
|
$ hg rebase --abort
|
|
rebase aborted
|
|
$ hg tglog
|
|
o 3: 79f6d6ab7b14 C
|
|
|
|
|
| o 2: ef8c0fe0897b D
|
|
| |
|
|
o | 1: 594087dbaf71 B
|
|
|/
|
|
o 0: 426bada5c675 A
|
|
|