tests/test-convert-bzr-merges.t
author Alexander Plavin <me@aplavin.ru>
Thu, 04 Jul 2013 14:18:44 +0400
changeset 19387 f2e4fdb3dd27
parent 16913 f2719b387380
child 26066 89872688893f
permissions -rw-r--r--
hgweb: code selection without line numbers in file source view All the source lines are put in a <pre> tag, which gives correct display and copy&paste in both Chromium (WebKit) and FireFox: line numbers are not copied, all the tabs and spaces are kept. This doesn't change the visual appearance of the view compared to current hgweb version and doesn't use any JS code. Also, stripes in this view are now generated clientside with CSS. This implementation is chosen because other variants have important issues: Strategy FF Chrome current D,LT,E,T,L D,L pre S,NW S,NW pre/div/nbsp LT,E,T,TS,NW TS,NW pre/div/br LT,E,T,NW NW ol/li/nbsp LT,E,T,TS,AJ TS,AJ ol/li/br LT,E,T,AJ AJ pre/span LV LV Legend Strategies: - current: implemented in hgweb before this patch, i.e. divs for each line, and line numbers links in the div too - pre: the whole code in one pre tag with newlines, all line numbers in another one with 'float: left' - pre/div/{nbsp,br}: same as just 'pre', but separate divs for each line and &nbsp; or <br> instead of empty lines (otherwise they are not copied at all) - ol/li/{nbsp,br}: a single ol with li's and divs for each line, &nbsp; or <br> same as in previous strategy - pre/span: this patch Problems: D = (very minor) display problems, like wrong width of leading tabs LT = loses leading/trailing whitespace E = loses embedded whitespace B = loses blank lines T = loses tabs L = selects line numbers LV = (only) visually selects line numbers LVE = (only) visually selects line numbers at empty lines S = no stripes (and no ability to easily highlight lines-which-are-linked-at in the future) TS = space copied instead of empty line AJ = get anchor links only with JS (they work even without) NW = no linewrap easily possible (in future) As for browser versions compatibility, the CSS tricks used are supported in (according to caniuse.com): a) line numbers generation with 'content:' property and CSS counters: IE 8+, all other popular browsers (in pre-WebKit Opera numbers are being copied) b) stripes ('nth-child' selector): IE 8+, FF 3.5+, Safari 3.2+, Opera 9.5+, all other popular browsers c) line numbers are not visually selected ('user-select:' property): IE 10+, Opera 15.0+, all other popular browsers This patch is based on a demo implementation by Martin Geisler <martin@geisler.net>.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
     1
N.B. bzr 1.13 has a bug that breaks this test.  If you see this
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
     2
test fail, check your bzr version.  Upgrading to bzr 1.13.1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
     3
should fix it.
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
     4
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
     5
  $ . "$TESTDIR/bzr-definitions"
8084
5b3fee9c1f4d Add comment about this test failing under bzr 1.13 due to a bug in bzr.
Greg Ward <greg-hg@gerg.ca>
parents: 7604
diff changeset
     6
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
     7
test multiple merges at once
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
     8
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
     9
  $ mkdir test-multimerge
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    10
  $ cd test-multimerge
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    11
  $ bzr init -q source
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    12
  $ cd source
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    13
  $ echo content > file
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    14
  $ bzr add -q file
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    15
  $ bzr commit -q -m 'Initial add'
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    16
  $ cd ..
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    17
  $ bzr branch -q source source-branch1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    18
  $ cd source-branch1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    19
  $ echo morecontent >> file
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    20
  $ echo evenmorecontent > file-branch1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    21
  $ bzr add -q file-branch1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    22
  $ bzr commit -q -m 'Added branch1 file'
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    23
  $ cd ../source
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    24
  $ sleep 1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    25
  $ echo content > file-parent
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    26
  $ bzr add -q file-parent
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    27
  $ bzr commit -q -m 'Added parent file'
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    28
  $ cd ..
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    29
  $ bzr branch -q source source-branch2
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    30
  $ cd source-branch2
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    31
  $ echo somecontent > file-branch2
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    32
  $ bzr add -q file-branch2
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    33
  $ bzr commit -q -m 'Added brach2 file'
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    34
  $ sleep 1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    35
  $ cd ../source
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    36
  $ bzr merge -q ../source-branch1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    37
  $ bzr merge -q --force ../source-branch2
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    38
  $ bzr commit -q -m 'Merged branches'
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    39
  $ cd ..
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    40
  $ hg convert --datesort source source-hg
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    41
  initializing destination source-hg repository
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    42
  scanning source...
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    43
  sorting...
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    44
  converting...
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    45
  4 Initial add
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    46
  3 Added branch1 file
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    47
  2 Added parent file
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    48
  1 Added brach2 file
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    49
  0 Merged branches
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    50
  $ glog -R source-hg
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12516
diff changeset
    51
  o    5@source "(octopus merge fixup)" files:
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    52
  |\
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12516
diff changeset
    53
  | o    4@source "Merged branches" files: file-branch2
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    54
  | |\
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12516
diff changeset
    55
  o---+  3@source-branch2 "Added brach2 file" files: file-branch2
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    56
   / /
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12516
diff changeset
    57
  | o  2@source "Added parent file" files: file-parent
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    58
  | |
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12516
diff changeset
    59
  o |  1@source-branch1 "Added branch1 file" files: file file-branch1
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    60
  |/
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12516
diff changeset
    61
  o  0@source "Initial add" files: file
12516
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    62
  
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    63
  $ manifest source-hg tip
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    64
  % manifest of tip
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    65
  644   file
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    66
  644   file-branch1
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    67
  644   file-branch2
90efbd1a2a56 tests: unify test-convert-bzr-merges
Matt Mackall <mpm@selenic.com>
parents: 8084
diff changeset
    68
  644   file-parent
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    69
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    70
  $ cd ..