Source

onsub / test-onsub-mixed.t

Full commit
Load extension:

  $ echo "[extensions]" >> $HGRCPATH
  $ echo "onsub = $TESTDIR/onsub.py" >> $HGRCPATH

Create some nicely nested subrepositories with mixed types:

  $ hg init
  $ for d in a b; do hg init $d; echo "$d = $d" >> .hgsub; done
  $ git init -q git-i
  $ cd git-i
  $ git config core.autocrlf false
  $ echo something > something
  $ git add something
  $ git commit -q -m init
  $ cd ..
  $ echo "git-i = [git]$git-i" >> .hgsub
  $ hg add .hgsub

  $ cd a

  $ git init -q git-j
  $ cd git-j
  $ git config core.autocrlf false
  $ echo something > something
  $ git add something
  $ git commit -q -m init
  $ cd ..
  $ echo "git-j = [git]git-j" >> .hgsub
  $ hg add .hgsub

  $ cd ..

  $ hg commit -m init -S
  committing subrepository a
  committing subrepository a/git-j
  committing subrepository b
  committing subrepository git-i

Test the subrepo type

  $ hg onsub 'echo $HG_SUBPATH = $HG_SUBTYPE'
  a = hg
  a/git-j = git
  b = hg
  git-i = git

Test the subrepo type including the root repository

  $ hg onsub 'echo $HG_SUBPATH = $HG_SUBTYPE' --root-repo
  . = hg
  a = hg
  a/git-j = git
  b = hg
  git-i = git

Test the type filter

  $ hg onsub 'echo $HG_SUBPATH' -t hg
  a
  b

  $ hg onsub 'echo $HG_SUBPATH' -t git
  a/git-j
  git-i

Test the type filter including the root repository

  $ hg onsub 'echo $HG_SUBPATH' -t hg --root-repo
  .
  a
  b

  $ hg onsub 'echo $HG_SUBPATH' -t git --root-repo
  a/git-j
  git-i