mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
1721f5f866
Summary:
Switch debugrebuildchangelog from using revlog stream clone to lazy segment clone.
This removes the revlog techdebt and can be used as a way to repair
repos with broken segmented changelog. As we migrate off double-write backend we
can no longer migrate down to revlog then migrate up, and a full reclone can be
slow. So a partial reclone command that just recreates the segmented changelog
seems useful.
This command is one of the two commands that handle emergency situations
when segmented changelog related logic goes wrong. The other command
is the emergency clone mode, added by D27897892 (d1413bbbad
), which assumes everything
related to segmented changelog is broken on Mononoke side and we still
need to commit and push. This command relies on segmented changelog
related features, such as hash<->location lookup, and clone on Mononoke
to work properly and the server having a compatible IdMap. So it might
not be able to address all issues if Mononoke goes wrong.
Reviewed By: DurhamG
Differential Revision: D28430885
fbshipit-source-id: 17357a33f6fda4a67d46e2c7e7be6653b530f499
150 lines
2.8 KiB
Perl
150 lines
2.8 KiB
Perl
#chg-compatible
|
|
|
|
$ configure modern
|
|
$ enable shelve
|
|
$ setconfig treemanifest.flatcompat=0
|
|
|
|
$ newrepo server
|
|
$ setconfig treemanifest.server=true
|
|
$ drawdag << 'EOS'
|
|
> C
|
|
> |
|
|
> B
|
|
> |
|
|
> A
|
|
> EOS
|
|
$ hg bookmark -r $C master
|
|
|
|
Clone:
|
|
|
|
$ cd $TESTTMP
|
|
$ hg clone --uncompressed ssh://user@dummy/server client
|
|
streaming all changes
|
|
6 files to transfer, 901 bytes of data
|
|
transferred 901 bytes in 0.0 seconds (880 KB/sec)
|
|
searching for changes
|
|
no changes found
|
|
updating to branch default
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
Add drafts:
|
|
|
|
$ cd client
|
|
$ drawdag << 'EOS'
|
|
> E
|
|
> |
|
|
> D F
|
|
> | |
|
|
> master desc(B)
|
|
> EOS
|
|
|
|
Rebuild using revlog:
|
|
|
|
$ hg debugrebuildchangelog --revlog
|
|
backed up 3 commits to commits-3-0000.bak
|
|
fetching changelog
|
|
6 files to transfer, 901 bytes of data
|
|
transferred 901 bytes in 0.0 seconds (880 KB/sec)
|
|
fetching selected remote bookmarks
|
|
recreated 3 local commits
|
|
changelog rebuilt
|
|
|
|
$ hg log -r 'all()' --git -T '{desc} {remotenames}' -G
|
|
o E
|
|
│
|
|
│ o F
|
|
│ │
|
|
o │ D
|
|
│ │
|
|
@ │ C remote/master
|
|
├─╯
|
|
o B
|
|
│
|
|
o A
|
|
|
|
|
|
Prepare another test case backed by a server repo that speaks EdenAPI
|
|
|
|
$ newremoterepo
|
|
$ setconfig paths.default=test:e
|
|
|
|
$ drawdag << 'EOS'
|
|
> E
|
|
> |
|
|
> D
|
|
> |
|
|
> C F
|
|
> |/
|
|
> B
|
|
> |
|
|
> A
|
|
> EOS
|
|
|
|
$ hg bookmark -r $D book-D
|
|
$ hg push -r $C --to master --create
|
|
pushing rev 26805aba1e60 to destination test:e bookmark master
|
|
searching for changes
|
|
exporting bookmark master
|
|
|
|
Prepare to test shelve:
|
|
|
|
$ hg up -q 'desc(F)'
|
|
$ echo 2 >> F
|
|
$ hg shelve
|
|
shelved as default
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
Rebuild using segmented changelog
|
|
|
|
$ hg debugrebuildchangelog
|
|
backed up 4 commits to commits-4-0000.bak
|
|
imported clone data with tip 26805aba1e600a82e93661149f2313866a221a7b
|
|
pulling latest commits
|
|
recreating 4 local commits
|
|
changelog rebuilt
|
|
|
|
$ hg log -r 'all()' --git -T '{desc} {remotenames} {bookmarks}' -G
|
|
@ F
|
|
│
|
|
│ o E
|
|
│ │
|
|
│ o D book-D
|
|
│ │
|
|
│ o C remote/master
|
|
├─╯
|
|
o B
|
|
│
|
|
o A
|
|
|
|
Unshelve works:
|
|
|
|
$ hg unshelve
|
|
unshelving change 'default'
|
|
|
|
$ cat F
|
|
F2
|
|
|
|
Test pull error does not end up with a broken repo:
|
|
|
|
$ hg debugrebuildchangelog --config fault-injection.debugrebuildchangelog-before-pull=1
|
|
backed up 3 commits to commits-3-0000.bak
|
|
imported clone data with tip 26805aba1e600a82e93661149f2313866a221a7b
|
|
pulling latest commits
|
|
restoring changelog from previous state
|
|
abort: injected error by tests: debugrebuildchangelog-before-pull
|
|
[255]
|
|
|
|
$ hg log -r 'all()' --git -T '{desc} {remotenames} {bookmarks}' -G
|
|
@ F
|
|
│
|
|
│ o E
|
|
│ │
|
|
│ o D book-D
|
|
│ │
|
|
│ o C remote/master
|
|
├─╯
|
|
o B
|
|
│
|
|
o A
|
|
|