tests/test-pull-branch.t
author Matt Harbison <matt_harbison@yahoo.com>
Sat, 16 May 2015 00:36:35 -0400
changeset 25122 755d23a49170
parent 17345 4f8054d3171b
child 25295 701df761aa94
permissions -rw-r--r--
match: resolve filesets in subrepos for commands given the '-S' argument This will work for any command that creates its matcher via scmutil.match(), but only the files command is tested here (both workingctx and basectx based tests). The previous behavior was to completely ignore the files in the subrepo, even though -S was given. My first attempt was to teach context.walk() to optionally recurse, but once that was in place and the complete file list was built up, the predicate test would fail with 'path in nested repo' when a file in a subrepo was accessed through the parent context. There are two slightly surprising behaviors with this functionality. First, any path provided inside the fileset isn't narrowed when it is passed to the subrepo. I dont see any clean way to do that in the matcher. Fortunately, the 'subrepo()' fileset is the only one to take a path. The second surprise is that status predicates are resolved against the subrepo, not the parent like 'hg status -S' is. I don't see any way to fix that either, given the path auditor error mentioned above.

  $ hg init t
  $ cd t
  $ echo 1 > foo
  $ hg ci -Am1 # 0
  adding foo
  $ hg branch branchA
  marked working directory as branch branchA
  (branches are permanent and global, did you want a bookmark?)
  $ echo a1 > foo
  $ hg ci -ma1 # 1

  $ cd ..
  $ hg init tt
  $ cd tt
  $ hg pull ../t
  pulling from ../t
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 2 changesets with 2 changes to 1 files
  (run 'hg update' to get a working copy)
  $ hg up branchA
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ cd ../t
  $ echo a2 > foo
  $ hg ci -ma2 # 2

Create branch B:

  $ hg up 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg branch branchB
  marked working directory as branch branchB
  (branches are permanent and global, did you want a bookmark?)
  $ echo b1 > foo
  $ hg ci -mb1 # 3

  $ cd ../tt

A new branch is there

  $ hg pull -u ../t
  pulling from ../t
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 2 changesets with 2 changes to 1 files (+1 heads)
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

Develop both branches:

  $ cd ../t
  $ hg up branchA
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a3 > foo
  $ hg ci -ma3 # 4
  $ hg up branchB
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo b2 > foo
  $ hg ci -mb2 # 5

  $ cd ../tt

Should succeed, no new heads:

  $ hg pull -u ../t
  pulling from ../t
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 2 changesets with 2 changes to 1 files
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

Add a head on other branch:

  $ cd ../t
  $ hg up branchA
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a4 > foo
  $ hg ci -ma4 # 6
  $ hg up branchB
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo b3.1 > foo
  $ hg ci -m b3.1 # 7
  $ hg up 5
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo b3.2 > foo
  $ hg ci -m b3.2 # 8
  created new head

  $ cd ../tt

Should succeed because there is only one head on our branch:

  $ hg pull -u ../t
  pulling from ../t
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 1 files (+1 heads)
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ cd ../t
  $ hg up -C branchA
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a5.1 > foo
  $ hg ci -ma5.1 # 9
  $ hg up 6
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a5.2 > foo
  $ hg ci -ma5.2 # 10
  created new head
  $ hg up 7
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo b4.1 > foo
  $ hg ci -m b4.1 # 11
  $ hg up -C 8
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo b4.2 > foo
  $ hg ci -m b4.2 # 12

  $ cd ../tt

  $ hg pull -u ../t
  pulling from ../t
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 4 changesets with 4 changes to 1 files (+1 heads)
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

Make changes on new branch on tt

  $ hg up 6
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg branch branchC
  marked working directory as branch branchC
  (branches are permanent and global, did you want a bookmark?)
  $ echo b1 > bar
  $ hg ci -Am "commit on branchC on tt"
  adding bar

Make changes on default branch on t

  $ cd ../t
  $ hg up -C default
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a1 > bar
  $ hg ci -Am "commit on default on t"
  adding bar

Pull branchC from tt

  $ hg pull ../tt
  pulling from ../tt
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files (+1 heads)
  (run 'hg heads' to see heads)

Make changes on default and branchC on tt

  $ cd ../tt
  $ hg pull ../t
  pulling from ../t
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files (+1 heads)
  (run 'hg heads' to see heads)
  $ hg up -C default
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a1 > bar1
  $ hg ci -Am "commit on default on tt"
  adding bar1
  $ hg up branchC
  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo a1 > bar2
  $ hg ci -Am "commit on branchC on tt"
  adding bar2

Make changes on default and branchC on t

  $ cd ../t
  $ hg up default
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a1 > bar3
  $ hg ci -Am "commit on default on t"
  adding bar3
  $ hg up branchC
  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo a1 > bar4
  $ hg ci -Am "commit on branchC on tt"
  adding bar4

Pull from tt

  $ hg pull ../tt
  pulling from ../tt
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 2 changesets with 2 changes to 2 files (+2 heads)
  (run 'hg heads .' to see heads, 'hg merge' to merge)

  $ cd ..