tests/test-convert-bzr-ghosts.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 15 Mar 2024 01:31:57 +0100
branchstable
changeset 51505 c9ceb4f60256
parent 47377 26127236b229
permissions -rw-r--r--
phases: avoid N² behavior in `advanceboundary` We allowed duplicated entries in the deque, which each entry could potentially insert all its ancestors. So advancing boundary for the full repository would mean each revision would walk all its ancestors, resulting in O(N²) iteration. For repository of any decent size, N² is quickly insane. We introduce a simple set to avoid this and get back to reasonable performance.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26066
89872688893f tests: move '#require bzr' into .t files
Gregory Szorc <gregory.szorc@gmail.com>
parents: 16913
diff changeset
     1
#require bzr
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
     2
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     3
  $ . "$TESTDIR/bzr-definitions"
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     4
  $ cat > ghostcreator.py <<EOF
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     5
  > import sys
47377
26127236b229 convert-bazaar: use breezy package instead of old bzr one
Raphaël Gomès <rgomes@octobus.net>
parents: 39707
diff changeset
     6
  > from breezy import workingtree
26127236b229 convert-bazaar: use breezy package instead of old bzr one
Raphaël Gomès <rgomes@octobus.net>
parents: 39707
diff changeset
     7
  > import breezy.bzr.bzrdir
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     8
  > wt = workingtree.WorkingTree.open('.')
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     9
  > 
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    10
  > message, ghostrev = sys.argv[1:]
47377
26127236b229 convert-bazaar: use breezy package instead of old bzr one
Raphaël Gomès <rgomes@octobus.net>
parents: 39707
diff changeset
    11
  > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev.encode()])
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    12
  > wt.commit(message)
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    13
  > EOF
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
ghost revisions
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
    16
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    17
  $ mkdir test-ghost-revisions
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    18
  $ cd test-ghost-revisions
47377
26127236b229 convert-bazaar: use breezy package instead of old bzr one
Raphaël Gomès <rgomes@octobus.net>
parents: 39707
diff changeset
    19
  $ brz init -q source
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    20
  $ cd source
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    21
  $ echo content > somefile
47377
26127236b229 convert-bazaar: use breezy package instead of old bzr one
Raphaël Gomès <rgomes@octobus.net>
parents: 39707
diff changeset
    22
  $ brz add -q somefile
26127236b229 convert-bazaar: use breezy package instead of old bzr one
Raphaël Gomès <rgomes@octobus.net>
parents: 39707
diff changeset
    23
  $ brz commit -q -m 'Initial layout setup'
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    24
  $ echo morecontent >> somefile
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 39222
diff changeset
    25
  $ "$PYTHON" ../../ghostcreator.py 'Commit with ghost revision' ghostrev
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    26
  $ cd ..
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    27
  $ hg convert source source-hg
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    28
  initializing destination source-hg repository
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    29
  scanning source...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    30
  sorting...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    31
  converting...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    32
  1 Initial layout setup
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    33
  0 Commit with ghost revision
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    34
  $ glog -R source-hg
39222
7a88643bc0ef tests: show added/modified/removed files when logging repos converted from bzr
Matt Harbison <matt_harbison@yahoo.com>
parents: 32940
diff changeset
    35
  o  1@source "Commit with ghost revision" files+: [], files-: [], files: [somefile]
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    36
  |
39222
7a88643bc0ef tests: show added/modified/removed files when logging repos converted from bzr
Matt Harbison <matt_harbison@yahoo.com>
parents: 32940
diff changeset
    37
  o  0@source "Initial layout setup" files+: [somefile], files-: [], files: []
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    38
  
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    39
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    40
  $ cd ..