Closed Bug 1654837 Opened 4 years ago Closed 1 year ago

Add an option to not abandon revisions on reorg

Categories

(Conduit :: moz-phab, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zalun, Assigned: sheehan)

References

Details

(Keywords: conduit-triaged)

Attachments

(1 file, 1 obsolete file)

Let's assume we've got a branch A from which we've moved one commit to a new branch B, then added a new commit on top of it.

* B1[D5] (HEAD -> branch B)
|
* A2[D2]
|
| * A4[D4] (branch A)
| |
| * A3[D3]
| |
| * A1[D1]
|/
* BASE (branches/default/tip)

We would like to keep both branches and fix the parent-child relationship.
Running moz-phab reorg would result with abandoning revisions from different branch.

moz-phab reorg
...
Stack will be reorganised:
 * A1[D1] will be abandoned
 * B1[D5] will depend on A2[D2]
 * A3[D3] will be abandoned
 * A4[D4] will be abandoned

Note: I've edited the moz-phab responses to make the example more readable.

I propose we add a --keep (temp name) option which would switch off abandoning revisions.

To replicate the tree in Suite:

git checkout -b A
echo a1 > A1; git add A1; git commit -am A1; echo a2 > A2; git add A2; git commit -am A2; echo a3 > A3; git add A3; git commit -am A3; echo a4 > A4; git add A4; git commit -am A4
moz-phab -b 1 -y
git checkout branches/default/tip
git checkout -b B
# STOP HERE TO GET SHA_A2
git cherry-pick SHA_A2
git checkout A
# STOP TO MANUALLY REBASE
git rebase -i HEAD~4
git checkout B
echo b1 > B1; git add B1; git commit -am B1
moz-phab -b 1 --single -y
See Also: → 1654547

B[D2] removed from A[D1] < B[D2] < C[D3]

$ moz-phab reorg
Reorganisation based on 2 commits:
Stack will be reorganised:
 * D3 will depend on D1
 * D2 will be abandoned
Perform reorganisation (YES/No)? n
$ moz-phab reorg --keep
Reorganisation based on 2 commits:
Stack will be reorganised:
 * D3 will depend on D1
 * D2 will no longer depend on D1
Perform reorganisation (YES/No)?
Stack has been reorganised.
Assignee: nobody → pzalewa
Status: NEW → ASSIGNED
Keywords: conduit-triaged
Assignee: pzalewa → nobody
Status: ASSIGNED → NEW
Assignee: nobody → pzalewa
Status: NEW → ASSIGNED
Assignee: pzalewa → nobody
Status: ASSIGNED → NEW

This is rather straightforward and I'm already doing some moz-phab reorg work, so I'm going to add it.

Assignee: nobody → sheehan

Adds a --no-abandon flag to avoid abandoning revisions during
moz-phab reorg. Revisions are abandoned when they are present
in the remote Phabricator stack but dropped from the local VCS
stack. This flag avoids adding the abandon transaction when
the flag is passed on the command line.

Depends on D167182

This is available in 1.4.0rc0 and later.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Attachment #9166518 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: