Skip to content
Snippets Groups Projects
test-subrepo.t 53.1 KiB
Newer Older
Let commit recurse into subrepos by default to match pre-2.0 behavior:

  $ echo "[ui]" >> $HGRCPATH
  $ echo "commitsubrepos = Yes" >> $HGRCPATH

Martin Geisler's avatar
Martin Geisler committed
  $ hg init t
  $ cd t

first revision, no sub

  $ echo a > a
  $ hg ci -Am0
  adding a

add first sub

  $ echo s = s > .hgsub
  $ hg add .hgsub
  $ hg init s
  $ echo a > s/a

Issue2232: committing a subrepo without .hgsub
Martin Geisler's avatar
Martin Geisler committed

  $ hg ci -mbad s
  abort: can't commit subrepos without .hgsub
  $ hg -R s add s/a
  $ hg files -S
  .hgsub
  a
`hg files` respects ui.relative-paths
BROKEN: shows subrepo paths relative to the subrepo
  $ hg files -S --config ui.relative-paths=no
  .hgsub
  a
Martin Geisler's avatar
Martin Geisler committed
  $ hg -R s ci -Ams0
  $ hg sum
  parent: 0:f7b1eb17ad24 tip
   0
  branch: default
  commit: 1 added, 1 subrepos
  update: (current)
Martin Geisler's avatar
Martin Geisler committed
  $ hg ci -m1

test handling .hgsubstate "added" explicitly.

  $ hg parents --template '{node}\n{files}\n'
  7cf8cfea66e410e8e3336508dfeec07b3192de51
  .hgsub .hgsubstate
  $ hg rollback -q
  $ hg add .hgsubstate
  $ hg ci -m1
  $ hg parents --template '{node}\n{files}\n'
  7cf8cfea66e410e8e3336508dfeec07b3192de51
  .hgsub .hgsubstate

Subrepopath which overlaps with filepath, does not change warnings in remove()

  $ mkdir snot
  $ touch snot/file
  $ hg remove -S snot/file
  not removing snot/file: file is untracked
  snot/filenot: no such file in rev 7cf8cfea66e4
Revert subrepo and test subrepo fileset keyword:
  $ hg revert --dry-run "set:subrepo('glob:s*')"
  reverting subrepo s
  $ hg revert "set:subrepo('glob:s*')"
Revert subrepo with no backup. The "reverting s/a" line is gone since
we're really running 'hg update' in the subrepo:

  $ echo b > s/a
  $ hg revert --no-backup s
  reverting subrepo s
Issue2022: update -C
Martin Geisler's avatar
Martin Geisler committed

  $ echo b > s/a
  $ hg sum
  parent: 1:7cf8cfea66e4 tip
   1
  branch: default
  commit: 1 subrepos
  update: (current)
Martin Geisler's avatar
Martin Geisler committed
  $ hg co -C 1
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg sum
  parent: 1:7cf8cfea66e4 tip
   1
  branch: default
  commit: (clean)
  update: (current)
commands that require a clean repo should respect subrepos

  $ echo b >> s/a
  $ hg backout tip
  abort: uncommitted changes in subrepository "s"
Martin Geisler's avatar
Martin Geisler committed
add sub sub

  $ echo ss = ss > s/.hgsub
  $ hg init s/ss
  $ echo a > s/ss/a
  $ hg -R s add s/.hgsub
  $ hg -R s/ss add s/ss/a
  $ hg sum
  parent: 1:7cf8cfea66e4 tip
   1
  branch: default
  commit: 1 subrepos
  update: (current)
Martin Geisler's avatar
Martin Geisler committed
  $ hg ci -m2
  committing subrepository s
  committing subrepository s/ss
Martin Geisler's avatar
Martin Geisler committed
  $ hg sum
  parent: 2:df30734270ae tip
   2
  branch: default
  commit: (clean)
  update: (current)
test handling .hgsubstate "modified" explicitly.

  $ hg parents --template '{node}\n{files}\n'
  df30734270ae757feb35e643b7018e818e78a9aa
  .hgsubstate
  $ hg rollback -q
  $ hg status -A .hgsubstate
  M .hgsubstate
  $ hg ci -m2
  $ hg parents --template '{node}\n{files}\n'
  df30734270ae757feb35e643b7018e818e78a9aa
  .hgsubstate

bump sub rev (and check it is ignored by ui.commitsubrepos)
Martin Geisler's avatar
Martin Geisler committed

  $ echo b > s/a
  $ hg -R s ci -ms1
  $ hg --config ui.commitsubrepos=no ci -m3
leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
Martin Geisler's avatar
Martin Geisler committed

  $ echo c > s/a
  $ hg --config ui.commitsubrepos=no ci -m4
  abort: uncommitted changes in subrepository "s"
  (use --subrepos for recursive commit)
  $ hg id
  f6affe3fbfaa+ tip
  $ hg -R s ci -mc
  $ hg id
  f6affe3fbfaa+ tip
  $ echo d > s/a
Martin Geisler's avatar
Martin Geisler committed
  $ hg ci -m4
  committing subrepository s
  $ hg tip -R s
Martin Geisler's avatar
Martin Geisler committed
  tag:         tip
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     4
  

check caching

  $ hg co 0
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ hg debugsub

restore

  $ hg co
Loading
Loading full blame...