Bug 1585192 Comment 11 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

The error is in `Mercurial::finalize` method.
We iterate over each commit in the stack rebasing to get the commits back in order.
Notation: `10:A[D1]` == `rev:SHA1[Phabricator revision]`

Before calling MozPhab  the second time (after `git histedit`) we had the workspce:
`7:C[] < 8:A[D1] < 9:B[D1]`

During the submission process MozPhab amended the `7:C[]` revision to add Phabricator URL to the summary.
In the finalize state (`Mercurial::finalize()`) the workspace contained hidden commit:
```
o  changeset:   10:C[D3]
|
| @  changeset:   9:B[D2]
| |
| *  changeset:   8:A[D1]
| |
| x  changeset:   7:C[]
|/  
|
o  changeset:   0:BASE
```

MozPhab started to rebase with `8:A[D1]`. This moved also the `9:B[D2]` and already looked like we want it to be finalized:
```
@  changeset:   12:B[D2]
|
o  changeset:   11:A[D1]
|
o  changeset:   10:C[D3]
|
o  changeset:   0:BASE
```

But the iteration https://github.com/mozilla-conduit/review/blob/master/mozphab/mercurial.py#L484-L490 wants to rebase again using the moved `8:B[D2]` (`hg rebase --source 8:B[D2] --dest 11:A[D1]`) which results with an error. 

Note: This iteration is required if all of the commits would be amended during the submission process.
Note2: Finalize stage is changing the SHA1 of an already submitted diff.
The error is in `Mercurial::finalize` method.
We iterate over each commit in the stack rebasing to get the commits back in order.
Notation: `10:A[D1]` == `rev:commit_name[Phabricator revision]`

Before calling MozPhab  the second time (after `git histedit`) we had the workspce:
`7:C[] < 8:A[D1] < 9:B[D1]`

During the submission process MozPhab amended the `7:C[]` revision to add Phabricator URL to the summary.
In the finalize state (`Mercurial::finalize()`) the workspace contained hidden commit:
```
o  changeset:   10:C[D3]
|
| @  changeset:   9:B[D2]
| |
| *  changeset:   8:A[D1]
| |
| x  changeset:   7:C[]
|/  
|
o  changeset:   0:BASE
```

MozPhab started to rebase with `8:A[D1]`. This moved also the `9:B[D2]` and already looked like we want it to be finalized:
```
@  changeset:   12:B[D2]
|
o  changeset:   11:A[D1]
|
o  changeset:   10:C[D3]
|
o  changeset:   0:BASE
```

But the iteration https://github.com/mozilla-conduit/review/blob/master/mozphab/mercurial.py#L484-L490 wants to rebase again using the moved `8:B[D2]` (`hg rebase --source 8:B[D2] --dest 11:A[D1]`) which results with an error. 

Note: This iteration is required if all of the commits would be amended during the submission process.
Note2: Finalize stage is changing the SHA1 of an already submitted diff.

Back to Bug 1585192 Comment 11