[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Symmetric merge -- tests

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Fri, 27 Apr 2012 12:04:22 +0100 (BST)

> Heads-up: I've added a test suite file, 'merge_symmetric_tests.py'. 

Stefan^2, Cristian, Oleksiy... maybe you'd like to help out with this?

This test file starts with depictions of the scenarios we're aiming to address.  So far, this is what I've come up with:

#   Merge once
#
#     A (--?---
#       (    \
#     B (--?--x

('?' means to test both with and without a change here; see the 'Key' below.)

#   Merge twice in same direction
#
#     A (--o-----?---
#       (    \     \
#     B (--o--x--?--x
#
#   Merge to and fro
#
#     A (--o-----?--x
#       (    \     /
#     B (--o--x--?---
#
#     A (--o-----o-----?--x
#       (    \     \     /
#     B (--o--x--o--x--?---
#
#     A (--o-----o--x--?--x
#       (    \     /     /
#     B (--o--x--o-----?---
#
#     A (--o-----o--x--?---
#       (    \     /     \
#     B (--o--x--o-----?--x
#
#   Merge with cherry-picks
#
#     Cherry1, fwd
#     A (--o-----o-[o]----o---
#       (    \        \     \
#     B (--o--x--?-----c-----x
#
#     Cherry2, fwd
#     A (--o-----?-----c--o---
#       (    \        /     \
#     B (--o--x--o-[o]-------x
#
#     Cherry3, fwd
#     A (--o-----?-------c--o----
#       (    \_____     /     \
#       (          \   /       \
#     B (--o--o-[o]-x-/---------x
#                 \__/
#
#     Cherry1, back
#     A (--o-----o-[o]-------x
#       (    \        \     /
#     B (--o--x--?-----c--o---
#
#     Cherry2, back
#     A (--o-----?-----c-----x
#       (    \        /     /
#     B (--o--x--o-[o]----o---
#
#     Cherry3, back
#     A (--o-----?-------c------x
#       (    \_____     /      /
#       (          \   /      /
#     B (--o--o-[o]-x-/-----o----
#                 \__/
#
#   Criss-cross merge
#
#     A (--o--?--x--?----
#       (    \ /     \
#       (     X       \
#       (    / \       \
#     B (--o--?--x--?---x
#
#   Subtree mergeinfo
#
#     ...
#
#   Sparse WC
#
#     ...
#
#   Mixed-rev WC
#
#     ...
#
#
# Key to diagrams:
#
#   o   - an original change
#   ?   - an original change or no-op (test both)
#   x   - a merge
#   c   - a cherry-pick merge
#   [o] - source range of a cherry-pick merge

I've created a few utility functions for easily creating these scenarios...

def make_branches(sbox):
  """Make branches A and B."""

def modify_branch(sbox, branch, number, conflicting=False):
  """Commit a modification to branch BRANCH. The actual modification depends
     on NUMBER.  If CONFLICTING=True, the change will be of a kind that
     conflicts with any other change that has CONFLICTING=True."""

def cherry_pick(sbox, rev, source, target):
  """Cherry-pick merge revision REV from branch SOURCE to branch TARGET
  (both WC-relative paths), and commit."""

def symmetric_merge(sbox, source, target, lines=None, args=[],
                    expect_mi=None, ...):
  """Do a complete, automatic merge from path SOURCE to path TARGET, and
  commit.  Verify the output and that there is no error.
  ### TODO: Verify the changes made.)

... and written tests for a few of the test scenarios.

Now I'm working on how to test for the expected results.  So far, symmetric_merge() checks that the mergeinfo addition on the target is a given list of revs.  Now I'm trying to check that the expected sequence of 3-way merges is performed, maybe initially by looking at the (current) debug output...

DBG: merge.c:11335: yca   svn://localhost:33705/svn-test-work/repositories/merge_symmetric_tests-1/A_at_1
DBG: merge.c:11336: base  svn://localhost:33705/svn-test-work/repositories/merge_symmetric_tests-1/A_at_1
DBG: merge.c:11338: mid   svn://localhost:33705/svn-test-work/repositories/merge_symmetric_tests-1/A_at_2
DBG: merge.c:11339: right svn://localhost:33705/svn-test-work/repositories/merge_symmetric_tests-1/A_at_2

or maybe by making the regular notifications more detailed than they currently are ...

--- Recording mergeinfo for merge between repository URLs into 'B':
 U   B

- Julian
Received on 2012-04-27 13:04:59 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.