tests/test-convert-bzr-ghosts.t
author Mads Kiilerich <madski@unity3d.com>
Fri, 28 Feb 2014 02:25:58 +0100
changeset 21545 43eecb4e23f8
parent 16913 f2719b387380
child 26066 89872688893f
permissions -rw-r--r--
merge: use separate lists for each action type This replaces the grand unified action list that had multiple action types as tuples in one big list. That list was iterated multiple times just to find actions of a specific type. This data model also made some code more convoluted than necessary. Instead we now store actions as a tuple of lists. Using multiple lists gives a bit of cut'n'pasted code but also enables other optimizations. This patch uses 'if True:' to preserve indentations and help reviewing. It also limits the number of conflicts with other pending patches. It can trivially be cleaned up later.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
     1
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     2
  $ . "$TESTDIR/bzr-definitions"
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     3
  $ cat > ghostcreator.py <<EOF
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     4
  > import sys
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     5
  > from bzrlib import workingtree
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     6
  > wt = workingtree.WorkingTree.open('.')
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     7
  > 
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     8
  > message, ghostrev = sys.argv[1:]
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     9
  > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev])
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    10
  > wt.commit(message)
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    11
  > EOF
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
    12
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    13
ghost revisions
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
    14
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    15
  $ mkdir test-ghost-revisions
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    16
  $ cd test-ghost-revisions
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    17
  $ bzr init -q source
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    18
  $ cd source
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    19
  $ echo content > somefile
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    20
  $ bzr add -q somefile
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    21
  $ bzr commit -q -m 'Initial layout setup'
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    22
  $ echo morecontent >> somefile
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    23
  $ python ../../ghostcreator.py 'Commit with ghost revision' ghostrev
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    24
  $ cd ..
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    25
  $ hg convert source source-hg
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    26
  initializing destination source-hg repository
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    27
  scanning source...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    28
  sorting...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    29
  converting...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    30
  1 Initial layout setup
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    31
  0 Commit with ghost revision
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    32
  $ glog -R source-hg
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12515
diff changeset
    33
  o  1@source "Commit with ghost revision" files: somefile
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    34
  |
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12515
diff changeset
    35
  o  0@source "Initial layout setup" files: somefile
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    36
  
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    37
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    38
  $ cd ..