Skip to content
Snippets Groups Projects
  • Matt Harbison's avatar
    28121415
    convert: avoid wrong lfconvert defaults by moving configitems to core · 28121415
    Matt Harbison authored
    The `hg lfconvert --to-normal` command uses the convert extension internally to
    work its magic, but that produced devel-warn messages if the convert extension
    wasn't loaded by the user.  The test in fcd2f9b06629 (modified here) wasn't
    showing the warnings because the convert extension was loaded via $HGRCPATH.
    Most of the config options default to None/False, but 'hg.usebranchnames' and
    'hg.tagsbranch' are supposed to default to True and 'default' respectively.
    
    The first iteration of this was to ui.setconfig() inside lfconvert, to force the
    convert extension to load.  But there really is no precedent for doing this, and
    check-config complained that 'extensions.convert' isn't documented.  Yuya
    suggested this alternative.
    
    This partially backs out 0d5a1175d0f9.
    28121415
    History
    convert: avoid wrong lfconvert defaults by moving configitems to core
    Matt Harbison authored
    The `hg lfconvert --to-normal` command uses the convert extension internally to
    work its magic, but that produced devel-warn messages if the convert extension
    wasn't loaded by the user.  The test in fcd2f9b06629 (modified here) wasn't
    showing the warnings because the convert extension was loaded via $HGRCPATH.
    Most of the config options default to None/False, but 'hg.usebranchnames' and
    'hg.tagsbranch' are supposed to default to True and 'default' respectively.
    
    The first iteration of this was to ui.setconfig() inside lfconvert, to force the
    convert extension to load.  But there really is no precedent for doing this, and
    check-config complained that 'extensions.convert' isn't documented.  Yuya
    suggested this alternative.
    
    This partially backs out 0d5a1175d0f9.
test-lfconvert.t 12.96 KiB
  $ USERCACHE="$TESTTMP/cache"; export USERCACHE
  $ mkdir "${USERCACHE}"
  $ cat >> $HGRCPATH <<EOF
  > [format]
  > usegeneraldelta=yes
  > [extensions]
  > largefiles =
  > share =
  > strip =
  > convert =
  > [largefiles]
  > minsize = 0.5
  > patterns = **.other
  >     **.dat
  > usercache=${USERCACHE}
  > EOF

"lfconvert" works
  $ hg init bigfile-repo
  $ cd bigfile-repo
  $ cat >> .hg/hgrc <<EOF
  > [extensions]
  > largefiles = !
  > EOF
  $ mkdir sub
  $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
  $ dd if=/dev/zero bs=1k count=256 > large2 2> /dev/null
  $ echo normal > normal1
  $ echo alsonormal > sub/normal2
  $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
  $ hg addremove
  adding large
  adding large2
  adding normal1
  adding sub/maybelarge.dat
  adding sub/normal2
  $ hg commit -m"add large, normal1" large normal1
  $ hg commit -m"add sub/*" sub

Test tag parsing
  $ cat >> .hgtags <<EOF
  > IncorrectlyFormattedTag!
  > invalidhash sometag
  > 0123456789abcdef anothertag
  > EOF
  $ hg add .hgtags
  $ hg commit -m"add large2" large2 .hgtags

Test link+rename largefile codepath
  $ [ -d .hg/largefiles ] && echo fail || echo pass
  pass
  $ cd ..
  $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
  initializing destination largefiles-repo
  skipping incorrectly formatted tag IncorrectlyFormattedTag!
  skipping incorrectly formatted id invalidhash
  no mapping for id 0123456789abcdef
#if symlink
  $ hg --cwd bigfile-repo rename large2 large3
  $ ln -sf large bigfile-repo/large3
  $ hg --cwd bigfile-repo commit -m"make large2 a symlink" large2 large3
  $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo-symlink
  initializing destination largefiles-repo-symlink
  skipping incorrectly formatted tag IncorrectlyFormattedTag!
  skipping incorrectly formatted id invalidhash
  no mapping for id 0123456789abcdef
  abort: renamed/copied largefile large3 becomes symlink
  [255]
#endif
  $ cd bigfile-repo