Mercurial > hg
view tests/test-rebase-cache.t @ 35098:66c5a8cf2868
lfs: import the Facebook git-lfs client extension
The purpose of this is the same as the built-in largefiles extension- to handle
huge files outside of the normal storage system, generally to keep the amount of
data cloned to a lower amount. There are several benefits of implementing the
git-lfs protocol, instead of using the largefiles extension:
- Bitbucket and Github support (and probably wider support in 3rd party
hosting sites in general). [1][2]
- The number of hg internals monkey patched are several orders of magnitude
lower, so it will be easier to reason about and maintain. Future commands
will likely just work, without requiring various wrappers.
- The "standin" files are only written to the filelog, not the disk. That
should avoid weird edge cases where the largefile and standin files get out
of sync. [3] It also avoids the occasional printing of the "hidden" standin
file in various messages.
- Filesets like size() will work, even if the file isn't present. (It always
says 41 bytes for largefiles, whether present or not.)
The only place that I see where largefiles comes out on top is that it works
with `hg serve` for simple sharing, without external infrastructure. Getting
lfs-test-server working was a hassle, and took awhile to figure out. Maybe we
can do something to make it work in the future.
Long term, I expect that this will be highly preferred over largefiles. But if
we are to recommend this to largefile users, there are some UI issues to
bikeshed. Until they are resolved, I've marked this experimental, and am not
putting a pointer to this in the largefiles help. The (non exhaustive) list of
issues I've seen so far are:
- It isn't sufficient to just enable the largefiles extension- you have to
explicitly add a file with --large before it will pay attention to the
configured sizes and patterns on future adds. The justification being that
once you use it, you're stuck with it. I've seen people confused by this,
and haven't liked it myself. But it's also saved me a few times. Should we
do something like have a specific enabling config setting that must be set
in the local repo config, so that enabling this extension in the user or
system hgrc doesn't silently start storing lfs files?
- The largefiles extension adds a repo requirement when the first largefile is
committed, so that the extension must always be enabled in the future. This
extension is not doing that, and since I only enabled it locally to avoid
infecting other repos, I got a cryptic error about missing flag processors
when I cloned. Is there no repo requirement due to shallow/narrow clone
considerations (or other future advanced things)?
- In the (small amount of) reading I've done about the git implementation, it
seems that the files and sizes are stored in a tracked .gitattributes file.
I think a tracked file for this would be extremely useful for consistency
across developers, but this kind of touches on the tracked hgrc file
proposal a few months back.
- The git client can specify file patterns, not just sizes.
- The largefiles extension has a cache directory in the local repo, but also a
system wide one. We should probably implement a system wide cache too, so
that multiple clones don't have to refetch the files from the server.
- Jun mentioned other missing features, like SSH authentication, gc, etc.
The code corresponds to c0492b73c7ef in hg-experimental. [4] The only tweaks
are to load the extension in the tests with 'lfs=' instead of
'lfs=$TESTDIR/../hgext3rd/lfs', change the import in the *.py test to hgext
(from hgext3rd), add the 'testedwith' declaration, and mark it experimental for
now. The infinite-push, p4fastimport, and remotefilelog tests were left behind.
The devel-warnings for unregistered config options are not corrected yet, nor
are the import check warnings.
[1] https://www.mercurial-scm.org/pipermail/mercurial/2017-November/050699.html
[2] https://bitbucket.org/site/master/issues/3843/largefiles-support-bb-3903
[3] https://bz.mercurial-scm.org/show_bug.cgi?id=5738
[4] https://bitbucket.org/facebook/hg-experimental
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 14 Nov 2017 00:06:23 -0500 |
parents | 3b7cb3d17137 |
children | 4441705b7111 |
line wrap: on
line source
$ cat >> $HGRCPATH <<EOF > [extensions] > rebase= > mq= > > [phases] > publish=False > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > theads = heads --template "{rev}: '{desc}' {branches}\n" > EOF $ hg init a $ cd a $ echo a > a $ hg ci -Am A adding a $ hg branch branch1 marked working directory as branch branch1 (branches are permanent and global, did you want a bookmark?) $ hg ci -m 'branch1' $ echo b > b $ hg ci -Am B adding b $ hg up -q 0 $ hg branch branch2 marked working directory as branch branch2 $ hg ci -m 'branch2' $ echo c > C $ hg ci -Am C adding C $ hg up -q 2 $ hg branch -f branch2 marked working directory as branch branch2 $ echo d > d $ hg ci -Am D adding d created new head $ echo e > e $ hg ci -Am E adding e $ hg update default 0 files updated, 0 files merged, 3 files removed, 0 files unresolved $ hg branch branch3 marked working directory as branch branch3 $ hg ci -m 'branch3' $ echo f > f $ hg ci -Am F adding f $ cd .. Rebase part of branch2 (5-6) onto branch3 (8): $ hg clone -q -u . a a1 $ cd a1 $ hg tglog @ 8: 'F' branch3 | o 7: 'branch3' branch3 | | o 6: 'E' branch2 | | | o 5: 'D' branch2 | | | | o 4: 'C' branch2 | | | +---o 3: 'branch2' branch2 | | | o 2: 'B' branch1 | | | o 1: 'branch1' branch1 |/ o 0: 'A' $ hg branches branch3 8:4666b71e8e32 branch2 6:5097051d331d branch1 2:0a03079c47fd (inactive) default 0:1994f17a630e (inactive) $ hg theads 8: 'F' branch3 6: 'E' branch2 4: 'C' branch2 2: 'B' branch1 0: 'A' $ hg rebase -s 5 -d 8 rebasing 5:635859577d0b "D" rebasing 6:5097051d331d "E" saved backup bundle to $TESTTMP/a1/.hg/strip-backup/635859577d0b-89160bff-rebase.hg (glob) $ hg branches branch3 8:466cdfb14b62 branch2 4:e4fdb121d036 branch1 2:0a03079c47fd default 0:1994f17a630e (inactive) $ hg theads 8: 'E' branch3 4: 'C' branch2 2: 'B' branch1 0: 'A' $ hg tglog o 8: 'E' branch3 | o 7: 'D' branch3 | @ 6: 'F' branch3 | o 5: 'branch3' branch3 | | o 4: 'C' branch2 | | | o 3: 'branch2' branch2 |/ | o 2: 'B' branch1 | | | o 1: 'branch1' branch1 |/ o 0: 'A' $ cd .. Rebase head of branch3 (8) onto branch2 (6): $ hg clone -q -u . a a2 $ cd a2 $ hg tglog @ 8: 'F' branch3 | o 7: 'branch3' branch3 | | o 6: 'E' branch2 | | | o 5: 'D' branch2 | | | | o 4: 'C' branch2 | | | +---o 3: 'branch2' branch2 | | | o 2: 'B' branch1 | | | o 1: 'branch1' branch1 |/ o 0: 'A' $ hg rebase -s 8 -d 6 rebasing 8:4666b71e8e32 "F" (tip) saved backup bundle to $TESTTMP/a2/.hg/strip-backup/4666b71e8e32-fc1c4e96-rebase.hg (glob) $ hg branches branch2 8:6b4bdc1b5ac0 branch3 7:653b9feb4616 branch1 2:0a03079c47fd (inactive) default 0:1994f17a630e (inactive) $ hg theads 8: 'F' branch2 7: 'branch3' branch3 4: 'C' branch2 2: 'B' branch1 0: 'A' $ hg tglog @ 8: 'F' branch2 | | o 7: 'branch3' branch3 | | o | 6: 'E' branch2 | | o | 5: 'D' branch2 | | | | o 4: 'C' branch2 | | | | | o 3: 'branch2' branch2 | |/ o | 2: 'B' branch1 | | o | 1: 'branch1' branch1 |/ o 0: 'A' $ hg verify -q $ cd .. Rebase entire branch3 (7-8) onto branch2 (6): $ hg clone -q -u . a a3 $ cd a3 $ hg tglog @ 8: 'F' branch3 | o 7: 'branch3' branch3 | | o 6: 'E' branch2 | | | o 5: 'D' branch2 | | | | o 4: 'C' branch2 | | | +---o 3: 'branch2' branch2 | | | o 2: 'B' branch1 | | | o 1: 'branch1' branch1 |/ o 0: 'A' $ hg rebase -s 7 -d 6 rebasing 7:653b9feb4616 "branch3" note: rebase of 7:653b9feb4616 created no changes to commit rebasing 8:4666b71e8e32 "F" (tip) saved backup bundle to $TESTTMP/a3/.hg/strip-backup/653b9feb4616-3c88de16-rebase.hg (glob) $ hg branches branch2 7:6b4bdc1b5ac0 branch1 2:0a03079c47fd (inactive) default 0:1994f17a630e (inactive) $ hg theads 7: 'F' branch2 4: 'C' branch2 2: 'B' branch1 0: 'A' $ hg tglog @ 7: 'F' branch2 | o 6: 'E' branch2 | o 5: 'D' branch2 | | o 4: 'C' branch2 | | | o 3: 'branch2' branch2 | | o | 2: 'B' branch1 | | o | 1: 'branch1' branch1 |/ o 0: 'A' $ hg verify -q Stripping multiple branches in one go bypasses the fast-case code to update the branch cache. $ hg strip 2 0 files updated, 0 files merged, 4 files removed, 0 files unresolved saved backup bundle to $TESTTMP/a3/.hg/strip-backup/0a03079c47fd-11b7c407-backup.hg (glob) $ hg tglog o 3: 'C' branch2 | o 2: 'branch2' branch2 | | @ 1: 'branch1' branch1 |/ o 0: 'A' $ hg branches branch2 3:e4fdb121d036 branch1 1:63379ac49655 default 0:1994f17a630e (inactive) $ hg theads 3: 'C' branch2 1: 'branch1' branch1 0: 'A' Fast path branchcache code should not be invoked if branches stripped is not the same as branches remaining. $ hg init b $ cd b $ hg branch branch1 marked working directory as branch branch1 (branches are permanent and global, did you want a bookmark?) $ hg ci -m 'branch1' $ hg branch branch2 marked working directory as branch branch2 $ hg ci -m 'branch2' $ hg branch -f branch1 marked working directory as branch branch1 $ echo a > A $ hg ci -Am A adding A created new head $ hg tglog @ 2: 'A' branch1 | o 1: 'branch2' branch2 | o 0: 'branch1' branch1 $ hg theads 2: 'A' branch1 1: 'branch2' branch2 $ hg strip 2 0 files updated, 0 files merged, 1 files removed, 0 files unresolved saved backup bundle to $TESTTMP/a3/b/.hg/strip-backup/a5b4b27ed7b4-a3b6984e-backup.hg (glob) $ hg theads 1: 'branch2' branch2 0: 'branch1' branch1 Make sure requesting to strip a revision already stripped does not confuse things. Try both orders. $ cd .. $ hg init c $ cd c $ echo a > a $ hg ci -Am A adding a $ echo b > b $ hg ci -Am B adding b $ echo c > c $ hg ci -Am C adding c $ echo d > d $ hg ci -Am D adding d $ echo e > e $ hg ci -Am E adding e $ hg tglog @ 4: 'E' | o 3: 'D' | o 2: 'C' | o 1: 'B' | o 0: 'A' $ hg strip 3 4 0 files updated, 0 files merged, 2 files removed, 0 files unresolved saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/67a385d4e6f2-b9243789-backup.hg (glob) $ hg theads 2: 'C' $ hg strip 2 1 0 files updated, 0 files merged, 2 files removed, 0 files unresolved saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/6c81ed0049f8-a687065f-backup.hg (glob) $ hg theads 0: 'A' Make sure rebase does not break for phase/filter related reason ---------------------------------------------------------------- (issue3858) $ cd .. $ cat >> $HGRCPATH << EOF > [ui] > logtemplate={rev} {desc} {phase}\n > EOF $ hg init c4 $ cd c4 $ echo a > a $ hg ci -Am A adding a $ echo b > b $ hg ci -Am B adding b $ hg up 0 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo c > c $ hg ci -Am C adding c created new head $ hg up 1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg merge 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m d $ hg up 2 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo e > e $ hg ci -Am E adding e created new head $ hg merge 3 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m F $ hg up 3 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo g > g $ hg ci -Am G adding g created new head $ echo h > h $ hg ci -Am H adding h $ hg up 5 1 files updated, 0 files merged, 2 files removed, 0 files unresolved $ echo i > i $ hg ci -Am I adding i Turn most changeset public $ hg ph -p 7 $ hg heads 8 I draft 7 H public $ hg log -G @ 8 I draft | | o 7 H public | | | o 6 G public | | o | 5 F draft |\| o | 4 E draft | | | o 3 d public |/| o | 2 C public | | | o 1 B public |/ o 0 A public $ cat > $TESTTMP/checkeditform.sh <<EOF > env | grep HGEDITFORM > true > EOF $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --dest 7 --source 5 -e rebasing 5:361a99976cc9 "F" HGEDITFORM=rebase.merge rebasing 8:326cfedc031c "I" (tip) HGEDITFORM=rebase.normal saved backup bundle to $TESTTMP/a3/c4/.hg/strip-backup/361a99976cc9-35e980d0-rebase.hg (glob)