Commit dc465f7
subtree: add --git-shallow-clone flag to subtree import
Summary:
Add a --git-shallow-clone flag to `sl subtree import` that fetches only the
requested commit using `git fetch --depth=1`. This is faster for importing
from large repositories since it avoids downloading full history.
The shallow-cloned Git repo is placed in a temp directory and deleted after
import, because a shallow clone lacks the commit history needed for blame
and log operations.
## Performance
### 1. facebook/sapling
Before
```
$ time sl subtree import --url https://github.com/facebook/sapling -r 5401649 --to-path fb_sl01 -m "import fb sl"
...
Receiving objects: 100% (1019726/1019726), 268.11 MiB | 48.80 MiB/s, done.
Resolving deltas: 100% (694194/694194), done.
...
________________________________________________________
Executed in 30.64 secs fish external
usr time 42.47 secs 0.00 micros 42.47 secs
sys time 17.92 secs 445.00 micros 17.92 secs
```
After
```
$ time sl subtree import --url https://github.com/facebook/sapling -r 5401649 --to-path fb_sl02 -m "import fb sl" --git-shallow-clone
...
Receiving objects: 100% (12613/12613), 29.62 MiB | 19.82 MiB/s, done.
Resolving deltas: 100% (2705/2705), done.
...
________________________________________________________
Executed in 17.35 secs fish external
usr time 6.73 secs 408.00 micros 6.73 secs
sys time 2.96 secs 27.00 micros 2.96 secs
```
### 2. python/cpython
Before
```
$ time sl subtree import --url https://github.com/python/cpython.git -r 36f15ba5cd15607fb4e4908ddbfb462c44626d6b --to-path cpython -m "import cpython"
...
________________________________________________________
Executed in 35.94 secs fish external
usr time 81.70 secs 405.00 micros 81.70 secs
sys time 13.57 secs 44.00 micros 13.57 secs
```
After
```
$ time sl subtree import --url https://github.com/python/cpython.git -r 36f15ba5cd15607fb4e4908ddbfb462c44626d6b --to-path cpython2 -m "import cpython" --git-shallow-clone
________________________________________________________
Executed in 15.44 secs fish external
usr time 5.16 secs 40.71 millis 5.11 secs
sys time 1.77 secs 4.97 millis 1.77 secs
```
Reviewed By: janezhang10
Differential Revision: D99630689
fbshipit-source-id: 5b912cd90884dd9b581d1f2ea4b41b189d107d5e1 parent b52a402 commit dc465f7
File tree
4 files changed
+76
-6
lines changed- eden/scm
- sapling
- commands
- tests
4 files changed
+76
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
158 | 161 | | |
159 | 162 | | |
160 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
161 | 170 | | |
162 | 171 | | |
163 | 172 | | |
| |||
177 | 186 | | |
178 | 187 | | |
179 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
180 | 194 | | |
181 | 195 | | |
182 | 196 | | |
| |||
825 | 839 | | |
826 | 840 | | |
827 | 841 | | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
828 | 862 | | |
829 | 863 | | |
830 | 864 | | |
| |||
850 | 884 | | |
851 | 885 | | |
852 | 886 | | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
858 | 893 | | |
859 | | - | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
860 | 899 | | |
861 | 900 | | |
862 | 901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
768 | 771 | | |
769 | 772 | | |
770 | 773 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
0 commit comments