Mercurial > hg
view tests/test-rebase-newancestor.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 | 3160876c6e4e |
children | 469b06b4c3ca |
line wrap: on
line source
$ cat >> $HGRCPATH <<EOF > [format] > usegeneraldelta=yes > [extensions] > rebase= > drawdag=$TESTDIR/drawdag.py > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF $ hg init repo $ cd repo $ echo A > a $ echo >> a $ hg ci -Am A adding a $ echo B > a $ echo >> a $ hg ci -m B $ echo C > a $ echo >> a $ hg ci -m C $ hg up -q -C 0 $ echo D >> a $ hg ci -Am AD created new head $ hg tglog @ 3: 'AD' | | o 2: 'C' | | | o 1: 'B' |/ o 0: 'A' $ hg rebase -s 1 -d 3 rebasing 1:0f4f7cb4f549 "B" merging a rebasing 2:30ae917c0e4f "C" merging a saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0f4f7cb4f549-82b3b163-rebase.hg (glob) $ hg tglog o 3: 'C' | o 2: 'B' | @ 1: 'AD' | o 0: 'A' $ cd .. Test rebasing of merges with ancestors of the rebase destination - a situation that often happens when trying to recover from repeated merging with a mainline branch. The test case creates a dev branch that contains a couple of merges from the default branch. When rebasing to the default branch, these merges would be merges with ancestors on the same branch. The merges _could_ contain some interesting conflict resolutions or additional changes in the merge commit, but that is mixed up with the actual merge stuff and there is in general no way to separate them. Note: The dev branch contains _no_ changes to f-default. It might be unclear how rebasing of ancestor merges should be handled, but the current behavior with spurious prompts for conflicts in files that didn't change seems very wrong. $ hg init ancestor-merge $ cd ancestor-merge $ touch f-default $ hg ci -Aqm 'default: create f-default' $ hg branch -q dev $ hg ci -qm 'dev: create branch' $ echo stuff > f-dev $ hg ci -Aqm 'dev: f-dev stuff' $ hg up -q default $ echo stuff > f-default $ hg ci -m 'default: f-default stuff' $ hg up -q dev $ hg merge -q default $ hg ci -m 'dev: merge default' $ hg up -q default $ hg rm f-default $ hg ci -m 'default: remove f-default' $ hg up -q dev $ hg merge -q default $ hg ci -m 'dev: merge default' $ hg up -q default $ echo stuff > f-other $ hg ci -Aqm 'default: f-other stuff' $ hg tglog @ 7: 'default: f-other stuff' | | o 6: 'dev: merge default' dev |/| o | 5: 'default: remove f-default' | | | o 4: 'dev: merge default' dev |/| o | 3: 'default: f-default stuff' | | | o 2: 'dev: f-dev stuff' dev | | | o 1: 'dev: create branch' dev |/ o 0: 'default: create f-default' $ hg clone -qU . ../ancestor-merge-2 Full rebase all the way back from branching point: $ hg rebase -r 'only(dev,default)' -d default --config ui.interactive=True << EOF > c > EOF rebasing 1:1d1a643d390e "dev: create branch" note: rebase of 1:1d1a643d390e created no changes to commit rebasing 2:ec2c14fb2984 "dev: f-dev stuff" rebasing 4:4b019212aaf6 "dev: merge default" other [source] changed f-default which local [dest] deleted use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c rebasing 6:9455ee510502 "dev: merge default" saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-43e9e04b-rebase.hg (glob) $ hg tglog o 6: 'dev: merge default' | o 5: 'dev: merge default' | o 4: 'dev: f-dev stuff' | @ 3: 'default: f-other stuff' | o 2: 'default: remove f-default' | o 1: 'default: f-default stuff' | o 0: 'default: create f-default' Grafty cherry picking rebasing: $ cd ../ancestor-merge-2 $ hg phase -fdr0: $ hg rebase -r 'children(only(dev,default))' -d default --config ui.interactive=True << EOF > c > EOF rebasing 2:ec2c14fb2984 "dev: f-dev stuff" rebasing 4:4b019212aaf6 "dev: merge default" other [source] changed f-default which local [dest] deleted use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c rebasing 6:9455ee510502 "dev: merge default" saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-62d0b222-rebase.hg (glob) $ hg tglog o 7: 'dev: merge default' | o 6: 'dev: merge default' | o 5: 'dev: f-dev stuff' | o 4: 'default: f-other stuff' | o 3: 'default: remove f-default' | o 2: 'default: f-default stuff' | | o 1: 'dev: create branch' dev |/ o 0: 'default: create f-default' $ cd .. Test order of parents of rebased merged with un-rebased changes as p1. $ hg init parentorder $ cd parentorder $ touch f $ hg ci -Aqm common $ touch change $ hg ci -Aqm change $ touch target $ hg ci -Aqm target $ hg up -qr 0 $ touch outside $ hg ci -Aqm outside $ hg merge -qr 1 $ hg ci -m 'merge p1 3=outside p2 1=ancestor' $ hg par changeset: 4:6990226659be tag: tip parent: 3:f59da8fc0fcf parent: 1:dd40c13f7a6f user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge p1 3=outside p2 1=ancestor $ hg up -qr 1 $ hg merge -qr 3 $ hg ci -qm 'merge p1 1=ancestor p2 3=outside' $ hg par changeset: 5:a57575f79074 tag: tip parent: 1:dd40c13f7a6f parent: 3:f59da8fc0fcf user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge p1 1=ancestor p2 3=outside $ hg tglog @ 5: 'merge p1 1=ancestor p2 3=outside' |\ +---o 4: 'merge p1 3=outside p2 1=ancestor' | |/ | o 3: 'outside' | | +---o 2: 'target' | | o | 1: 'change' |/ o 0: 'common' $ hg rebase -r 4 -d 2 rebasing 4:6990226659be "merge p1 3=outside p2 1=ancestor" saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/6990226659be-4d67a0d3-rebase.hg (glob) $ hg tip changeset: 5:cca50676b1c5 tag: tip parent: 2:a60552eb93fb parent: 3:f59da8fc0fcf user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge p1 3=outside p2 1=ancestor $ hg rebase -r 4 -d 2 rebasing 4:a57575f79074 "merge p1 1=ancestor p2 3=outside" saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/a57575f79074-385426e5-rebase.hg (glob) $ hg tip changeset: 5:f9daf77ffe76 tag: tip parent: 2:a60552eb93fb parent: 3:f59da8fc0fcf user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge p1 1=ancestor p2 3=outside $ hg tglog @ 5: 'merge p1 1=ancestor p2 3=outside' |\ +---o 4: 'merge p1 3=outside p2 1=ancestor' | |/ | o 3: 'outside' | | o | 2: 'target' | | o | 1: 'change' |/ o 0: 'common' rebase of merge of ancestors $ hg up -qr 2 $ hg merge -qr 3 $ echo 'other change while merging future "rebase ancestors"' > other $ hg ci -Aqm 'merge rebase ancestors' $ hg rebase -d 5 -v rebasing 6:4c5f12f25ebe "merge rebase ancestors" (tip) resolving manifests removing other note: merging f9daf77ffe76+ and 4c5f12f25ebe using bids from ancestors a60552eb93fb and f59da8fc0fcf calculating bids for ancestor a60552eb93fb resolving manifests calculating bids for ancestor f59da8fc0fcf resolving manifests auction for merging merge bids other: consensus for g end of auction getting other committing files: other committing manifest committing changelog rebase merging completed 1 changesets found uncompressed size of bundle content: 199 (changelog) 216 (manifests) 182 other saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-f46990e5-rebase.hg (glob) 1 changesets found uncompressed size of bundle content: 254 (changelog) 167 (manifests) 182 other adding branch adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files rebase completed $ hg tglog @ 6: 'merge rebase ancestors' | o 5: 'merge p1 1=ancestor p2 3=outside' |\ +---o 4: 'merge p1 3=outside p2 1=ancestor' | |/ | o 3: 'outside' | | o | 2: 'target' | | o | 1: 'change' |/ o 0: 'common' Due to the limitation of 3-way merge algorithm (1 merge base), rebasing a merge may include unwanted content: $ hg init $TESTTMP/dual-merge-base1 $ cd $TESTTMP/dual-merge-base1 $ hg debugdrawdag <<'EOS' > F > /| > D E > | | > B C > |/ > A Z > |/ > R > EOS $ hg rebase -r D+E+F -d Z rebasing 5:5f2c926dfecf "D" (D) rebasing 6:b296604d9846 "E" (E) rebasing 7:caa9781e507d "F" (F tip) abort: rebasing 7:caa9781e507d will include unwanted changes from 4:d6003a550c2c or 3:c1e6b162678d [255] The warning does not get printed if there is no unwanted change detected: $ hg init $TESTTMP/dual-merge-base2 $ cd $TESTTMP/dual-merge-base2 $ hg debugdrawdag <<'EOS' > D > /| > B C > |/ > A Z > |/ > R > EOS $ hg rebase -r B+C+D -d Z rebasing 3:c1e6b162678d "B" (B) rebasing 4:d6003a550c2c "C" (C) rebasing 5:c8f78076273e "D" (D tip) saved backup bundle to $TESTTMP/dual-merge-base2/.hg/strip-backup/d6003a550c2c-6f1424b6-rebase.hg (glob) $ hg manifest -r 'desc(D)' B C R Z The merge base could be different from old p1 (changed parent becomes new p1): $ hg init $TESTTMP/chosen-merge-base1 $ cd $TESTTMP/chosen-merge-base1 $ hg debugdrawdag <<'EOS' > F > /| > D E > | | > B C Z > EOS $ hg rebase -r D+F -d Z rebasing 3:004dc1679908 "D" (D) rebasing 5:4be4cbf6f206 "F" (F tip) saved backup bundle to $TESTTMP/chosen-merge-base1/.hg/strip-backup/004dc1679908-06a66a3c-rebase.hg (glob) $ hg manifest -r 'desc(F)' C D E Z $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n' D $ hg init $TESTTMP/chosen-merge-base2 $ cd $TESTTMP/chosen-merge-base2 $ hg debugdrawdag <<'EOS' > F > /| > D E > | | > B C Z > EOS $ hg rebase -r E+F -d Z rebasing 4:974e4943c210 "E" (E) rebasing 5:4be4cbf6f206 "F" (F tip) saved backup bundle to $TESTTMP/chosen-merge-base2/.hg/strip-backup/974e4943c210-b2874da5-rebase.hg (glob) $ hg manifest -r 'desc(F)' B D E Z $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n' E