sapling/eden/scm/tests/test-fb-ext-remotefilelog-bad-configs.t
Jun Wu 2eb818db71 workingcopy: add tracing about why it might fail
Summary:
When I tried to create a real repo with TESTTMP unset for documentation, I got
mysterious errors like:

  File "/opt/fb/mercurial/edenscm/dirstate.py", line 186, in make_treestate
    ui, opener, root, self._repo._rsrepo.workingcopy().treestate()
    # root = '$TESTTMP/repo1'
  error.WorkingCopyError: working copy is missing information or corrupt: No such file or directory (os error 2) at path "$TESTTMP/repo1/$TESTTMP/.tmp2f2UD9 (ef5a29b32a)"

This diff adds tracing logs in various layers to help narrow it down.

The error message is changed since the underlying errors can be unrelated to
the working copy directly.

For now I just trace the mysterious error down. Note the logs are for component
initialization, which usually just run once. They are not in hot paths to
affect performance.

A more systematic solution might be using the `fn_error_context` crate and
enforce functions returning errors to attach context.

Reviewed By: muirdm

Differential Revision: D42102949

fbshipit-source-id: 6060bebe280a72ab6cd32e4d0eb55e5332612287
2022-12-16 14:04:17 -08:00

33 lines
723 B
Perl

#chg-compatible
$ configure modernclient
no-check-code
$ . "$TESTDIR/library.sh"
$ newclientrepo master
$ echo x > x
$ echo y > y
$ echo z > z
$ hg commit -qAm xy
$ hg push --to master --create -q
$ newclientrepo shallow test:master_server
Verify error message when no cachepath specified
$ hg up -q null
$ cp $HGRCPATH $HGRCPATH.bak
$ sed -i.bak -n "/cachepath/!p" $HGRCPATH
$ hg up tip
abort: could not find config option remotefilelog.cachepath
[255]
$ mv $HGRCPATH.bak $HGRCPATH
Verify error message when no fallback specified
$ hg up -q null
$ rm .hg/hgrc
$ clearcache
$ hg up tip
abort: cannot initialize working copy: Missing required config item: edenapi.url
[255]