tests/test-convert-bzr-treeroot.t
author Angel Ezquerra <angel.ezquerra@gmail.com>
Sat, 16 Feb 2013 01:18:53 +0100
changeset 18939 aab0c14c20d0
parent 16913 f2719b387380
child 26066 89872688893f
permissions -rw-r--r--
subrepo: implement "storeclean" method for mercurial subrepos The mercurial subrepo "storeclean" method works by calculating a "store hash" of the repository state and comparing it to a cached store hash. The store hash is always cached when the repository is cloned from or pushed to a remote repository, but also on pull as long as the repository already had a clean store. If the hashes match the store is "clean" versus the selected repository. Note that this method is currenty unused, but it will be used by a later patch. The store hash is calculated by hashing several key repository files, such as the bookmarks file the phaseroots file and the changelog. Note that the hash comparison is done file by file so that we can exit early if a pair of hashes do not match. Also the hashes are calculated starting with the file that is most likely to be smaller upto the file that is more likely to be larger.
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
12517
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     2
  $ . "$TESTDIR/bzr-definitions"
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     3
  $ cat > treeset.py <<EOF
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     4
  > import sys
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     5
  > from bzrlib import workingtree
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     6
  > wt = workingtree.WorkingTree.open('.')
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     7
  > 
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     8
  > message, rootid = sys.argv[1:]
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     9
  > wt.set_root_id('tree_root-%s' % rootid)
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    10
  > wt.commit(message)
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    11
  > EOF
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    12
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    13
change the id of the tree root
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
    14
12517
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    15
  $ mkdir test-change-treeroot-id
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    16
  $ cd test-change-treeroot-id
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    17
  $ bzr init -q source
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    18
  $ cd source
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    19
  $ echo content > file
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    20
  $ bzr add -q file
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    21
  $ bzr commit -q -m 'Initial add'
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    22
  $ python ../../treeset.py 'Changed root' new
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    23
  $ cd ..
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    24
  $ hg convert source source-hg
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    25
  initializing destination source-hg repository
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    26
  scanning source...
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    27
  sorting...
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    28
  converting...
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    29
  1 Initial add
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    30
  0 Changed root
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    31
  $ manifest source-hg tip
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    32
  % manifest of tip
cc8f1083e8be tests: unify test-convert-bzr-treeroot
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    33
  644   file
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 12517
diff changeset
    34
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 12517
diff changeset
    35
  $ cd ..