tests/test-narrow-sparse.t
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 22 Aug 2021 17:59:21 -0400
branchstable
changeset 47866 4162f6b40f2c
parent 47303 e4ccc341e65b
child 48295 bf11ff22a9af
permissions -rw-r--r--
windows: degrade to py2 behavior when reading a non-symlink as a symlink While waiting for the push to hg-committed in WSL to complete, I ran a `phabimport` from Windows and got this traceback: $ hg phabimport 11313 ** Unknown exception encountered with possibly-broken third-party extension "mercurial_keyring" (version N/A) ** which supports versions unknown of Mercurial. ** Please disable "mercurial_keyring" and try your action again. ** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues ** Python 3.9.5 (default, May 6 2021, 17:29:31) [MSC v.1928 64 bit (AMD64)] ** Mercurial Distributed SCM (version 5.9rc1+hg32.0e2f5733563d) ** Extensions loaded: absorb, blackbox, evolve 10.3.3, extdiff, fastannotate, fix, mercurial_keyring, mq, phabblocker 20210126, phabricator, rebase, show, strip, topic 0.22.3 Traceback (most recent call last): File "mercurial.lock", line 279, in _trylock File "mercurial.vfs", line 202, in makelock File "mercurial.util", line 2147, in makelock FileExistsError: [WinError 183] Cannot create a file when that file already exists: b'hp-omen:78348' -> b'C:\\Users\\Matt\\hg/.hg/store/lock' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 24, in <module> File "mercurial.dispatch", line 144, in run File "mercurial.dispatch", line 250, in dispatch File "mercurial.dispatch", line 294, in _rundispatch File "mercurial.dispatch", line 470, in _runcatch File "mercurial.dispatch", line 480, in _callcatch File "mercurial.scmutil", line 153, in callcatch File "mercurial.dispatch", line 460, in _runcatchfunc File "mercurial.dispatch", line 1273, in _dispatch File "mercurial.dispatch", line 918, in runcommand File "mercurial.dispatch", line 1285, in _runcommand File "mercurial.dispatch", line 1271, in <lambda> File "mercurial.util", line 1886, in check File "mercurial.util", line 1886, in check File "hgext.mq", line 4239, in mqcommand File "mercurial.util", line 1886, in check File "mercurial.util", line 1886, in check File "hgext.phabricator", line 314, in inner File "hgext.phabricator", line 2222, in phabimport File "hgext.phabricator", line 2123, in readpatch File "hgext.phabricator", line 2199, in _write File "mercurial.localrepo", line 2956, in lock File "mercurial.localrepo", line 2918, in _lock File "mercurial.lock", line 152, in trylock File "mercurial.lock", line 283, in _trylock File "mercurial.lock", line 314, in _readlock File "mercurial.vfs", line 221, in readlock File "mercurial.util", line 2163, in readlock File "mercurial.windows", line 619, in readlink ValueError: not a symbolic link Both exceptions look accurate (the file exists, and the Windows side can't read WSL side symlinks). I didn't try to reproduce this entirely within the Windows side, but we can do better than a cryptic stacktrace. With this change, the same scenario results in this abort: abort: C:\Users\Matt\hg/.hg/store/lock: The file cannot be accessed by the system When both the `push` and `phabimport` are done on the Windows side, it prints a message about waiting for the lock, and successfully applies the patch after the push completes. I'm not sure if there's enough info to be able to convert the abort into the wait scenario. As it stands now, we don't support symlinks on Windows, which requires either a UAC Administrator level process or an opt-in in developer mode, and there are several places where the new symlink on Windows support in py3 was explicitly disabled in order to get tests to pass quicker. Differential Revision: https://phab.mercurial-scm.org/D11333
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41147
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     1
Testing interaction of sparse and narrow when both are enabled on the client
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     2
side and we do a non-ellipsis clone
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     3
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     4
#testcases tree flat
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     5
  $ . "$TESTDIR/narrow-library.sh"
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     6
  $ cat << EOF >> $HGRCPATH
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     7
  > [extensions]
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     8
  > sparse =
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
     9
  > EOF
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    10
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    11
#if tree
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    12
  $ cat << EOF >> $HGRCPATH
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    13
  > [experimental]
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    14
  > treemanifest = 1
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    15
  > EOF
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    16
#endif
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    17
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    18
  $ hg init master
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    19
  $ cd master
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    20
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    21
  $ mkdir inside
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    22
  $ echo 'inside' > inside/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    23
  $ hg add inside/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    24
  $ hg commit -m 'add inside'
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    25
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    26
  $ mkdir widest
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    27
  $ echo 'widest' > widest/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    28
  $ hg add widest/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    29
  $ hg commit -m 'add widest'
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    30
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    31
  $ mkdir outside
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    32
  $ echo 'outside' > outside/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    33
  $ hg add outside/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    34
  $ hg commit -m 'add outside'
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    35
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    36
  $ cd ..
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    37
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    38
narrow clone the inside file
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    39
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    40
  $ hg clone --narrow ssh://user@dummy/master narrow --include inside/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    41
  requesting all changes
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    42
  adding changesets
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    43
  adding manifests
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    44
  adding file changes
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    45
  added 3 changesets with 1 changes to 1 files
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    46
  new changesets *:* (glob)
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    47
  updating to branch default
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    48
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    49
  $ cd narrow
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    50
  $ hg tracked
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    51
  I path:inside/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    52
  $ hg files
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    53
  inside/f
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    54
41148
8eaf693b1409 sparse: don't enable on clone if it was a narrow clone
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41147
diff changeset
    55
XXX: we should have a flag in `hg debugsparse` to list the sparse profile
8eaf693b1409 sparse: don't enable on clone if it was a narrow clone
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41147
diff changeset
    56
  $ test -f .hg/sparse
8eaf693b1409 sparse: don't enable on clone if it was a narrow clone
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41147
diff changeset
    57
  [1]
41147
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    58
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    59
  $ cat .hg/requires
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    60
  dotencode
47279
40b51c28b242 dirstate-v2: Update the expected output of some tests for new requirement
Simon Sapin <simon.sapin@octobus.net>
parents: 46884
diff changeset
    61
  exp-dirstate-v2 (dirstate-v2 !)
41147
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    62
  fncache
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    63
  generaldelta
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    64
  narrowhg-experimental
46884
cc3ad5c3af3b persistent-nodemap: enable the feature by default when using Rust
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46874
diff changeset
    65
  persistent-nodemap (rust !)
46874
84a93fa7ecfd revlog-compression: use zstd by default (if available)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41150
diff changeset
    66
  revlog-compression-zstd (zstd !)
41147
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    67
  revlogv1
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    68
  sparserevlog
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    69
  store
eb172f9c208c tests: add tests for narrow clone when both sparse and narrow are enabled
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
diff changeset
    70
  treemanifest (tree !)
41149
76dcf7958c5f tests: show that debugrebuilddirstate is broken with narrow+sparse
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41148
diff changeset
    71
76dcf7958c5f tests: show that debugrebuilddirstate is broken with narrow+sparse
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41148
diff changeset
    72
  $ hg debugrebuilddirstate
47303
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    73
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    74
We only make the following assertions for the flat test case since in the
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    75
treemanifest test case debugsparse fails with "path ends in directory
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    76
separator: outside/" which seems like a bug unrelated to the regression this is
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    77
testing for.
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    78
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    79
#if flat
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    80
widening with both sparse and narrow is possible
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    81
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    82
  $ cat >> .hg/hgrc <<EOF
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    83
  > [extensions]
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    84
  > sparse = 
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    85
  > narrow = 
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    86
  > EOF
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    87
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    88
  $ hg debugsparse -X outside/f -X widest/f
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    89
  $ hg tracked -q --addinclude outside/f
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    90
  $ find . -name .hg -prune -o -type f -print | sort
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    91
  ./inside/f
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    92
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    93
  $ hg debugsparse -d outside/f
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    94
  $ find . -name .hg -prune -o -type f -print | sort
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    95
  ./inside/f
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    96
  ./outside/f
e4ccc341e65b narrow: widen when files are excluded by sparse and not included by narrow
Charles Chamberlain <cchamberlain@janestreet.com>
parents: 47279
diff changeset
    97
#endif