view tests/test-histedit-base.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 eb586ed5d8ce
children 89630d0b3e23
line wrap: on
line source

  $ . "$TESTDIR/histedit-helpers.sh"

  $ cat >> $HGRCPATH <<EOF
  > [alias]
  > tglog = log -G --template "{rev}:{node}:{phase} '{desc}'\n"
  > [extensions]
  > histedit=
  > EOF

Create repo a:

  $ hg init a
  $ cd a
  $ hg unbundle "$TESTDIR/bundles/rebase.hg"
  adding changesets
  adding manifests
  adding file changes
  added 8 changesets with 7 changes to 7 files (+2 heads)
  new changesets cd010b8cd998:02de42196ebe
  (run 'hg heads' to see heads, 'hg merge' to merge)
  $ hg up tip
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ hg tglog
  @  7:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  |
  | o  6:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  |/|
  o |  5:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  | |
  | o  4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  | o  3:32af7686d403cf45b5d95f2d70cebea587ac806a:draft 'D'
  | |
  | o  2:5fddd98957c8a54a4d436dfe1da9d87f21a1b97b:draft 'C'
  | |
  | o  1:42ccdea3bb16d28e1848c95fe2e44c000f3f21b1:draft 'B'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Verify that implicit base command and help are listed

  $ HGEDITOR=cat hg histedit |grep base
  #  b, base = checkout changeset and apply further changesets from there

Go to D
  $ hg update 3
  3 files updated, 0 files merged, 2 files removed, 0 files unresolved
edit the history to rebase B onto H


Rebase B onto H
  $ hg histedit 1 --commands - 2>&1 << EOF | fixbundle
  > base 02de42196ebe
  > pick 42ccdea3bb16 B
  > pick 5fddd98957c8 C
  > pick 32af7686d403 D
  > EOF

  $ hg tglog
  @  7:0937e82309df47d14176ee15e45dbec5fbdef340:draft 'D'
  |
  o  6:f778d1cbddac4ab679d9983c9bb92e4c5e09e7fa:draft 'C'
  |
  o  5:3d41b7cc708545206213a842f96d812d2e73d818:draft 'B'
  |
  o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  |
  | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  |/|
  o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  | |
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Rebase back and drop something
  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
  > base cd010b8cd998
  > pick 3d41b7cc7085 B
  > drop f778d1cbddac C
  > pick 0937e82309df D
  > EOF

  $ hg tglog
  @  6:476cc3e4168da2d036b141f7f7dcff7f8e3fe846:draft 'D'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Split stack
  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
  > base cd010b8cd998
  > pick d273e35dcdf2 B
  > base cd010b8cd998
  > pick 476cc3e4168d D
  > EOF

  $ hg tglog
  @  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
  |
  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |/
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Abort
  $ echo x > B
  $ hg add B
  $ hg commit -m "X"
  $ hg tglog
  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
  |
  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
  |
  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |/
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
  > base d273e35dcdf2 B
  > drop d7a6f907a822 D
  > pick 591369deedfd X
  > EOF
  merging B
  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
  Fix up the change (pick 591369deedfd)
  (hg histedit --continue to resume)
  $ hg histedit --abort | fixbundle
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg tglog
  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
  |
  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
  |
  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |/
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Continue
  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
  > base d273e35dcdf2 B
  > drop d7a6f907a822 D
  > pick 591369deedfd X
  > EOF
  merging B
  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
  Fix up the change (pick 591369deedfd)
  (hg histedit --continue to resume)
  $ echo b2 > B
  $ hg resolve --mark B
  (no more unresolved files)
  continue: hg histedit --continue
  $ hg histedit --continue | fixbundle
  $ hg tglog
  @  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  

base on a previously picked changeset
  $ echo i > i
  $ hg add i
  $ hg commit -m "I"
  $ echo j > j
  $ hg add j
  $ hg commit -m "J"
  $ hg tglog
  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
  |
  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
  |
  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
  > pick d273e35dcdf2 B
  > pick 03772da75548 X
  > base d273e35dcdf2 B
  > pick e8c55b19d366 J
  > base d273e35dcdf2 B
  > pick b2f90fd8aa85 I
  > EOF
  hg: parse error: base "d273e35dcdf2" changeset was an edited list candidate
  (base must only use unlisted changesets)

  $ hg tglog
  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
  |
  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
  |
  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'