tests/test-inotify-dirty-dirstate.t
author Alexander Plavin <me@aplavin.ru>
Thu, 04 Jul 2013 14:18:44 +0400
changeset 19387 f2e4fdb3dd27
parent 16913 f2719b387380
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:
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
     1
issues when status queries are issued when dirstate is dirty
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     2
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
     3
  $ "$TESTDIR/hghave" inotify || exit 80
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
     4
  $ echo "[extensions]" >> $HGRCPATH
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
     5
  $ echo "inotify=" >> $HGRCPATH
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
     6
  $ echo "fetch=" >> $HGRCPATH
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     7
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
     8
issue1810: inotify and fetch
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
     9
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 12452
diff changeset
    10
  $ hg init test; cd test
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    11
  $ hg inserve -d --pid-file=../hg.pid
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    12
  $ cat ../hg.pid >> "$DAEMON_PIDS"
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    13
  $ echo foo > foo
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    14
  $ hg add
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    15
  adding foo
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    16
  $ hg ci -m foo
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    17
  $ cd ..
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    18
  $ hg --config "inotify.pidfile=../hg2.pid" clone test test2
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    19
  updating to branch default
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    20
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    21
  $ cat ../hg2.pid >> "$DAEMON_PIDS"
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    22
  $ cd test2
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    23
  $ echo bar > bar
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    24
  $ hg add
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    25
  adding bar
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    26
  $ hg ci -m bar
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    27
  $ cd ../test
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    28
  $ echo spam > spam
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    29
  $ hg add
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    30
  adding spam
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    31
  $ hg ci -m spam
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    32
  $ cd ../test2
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    33
  $ hg st
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    34
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    35
abort, outstanding changes
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    36
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    37
  $ hg fetch -q
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    38
  $ hg st
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    39
  $ cd ..
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    40
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    41
issue1719: inotify and mq
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    42
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    43
  $ echo "mq=" >> $HGRCPATH
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    44
  $ hg init test-1719
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    45
  $ cd test-1719
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    46
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    47
inserve
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    48
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    49
  $ hg inserve -d --pid-file=../hg-test-1719.pid
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    50
  $ cat ../hg-test-1719.pid >> "$DAEMON_PIDS"
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    51
  $ echo content > file
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    52
  $ hg add file
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    53
  $ hg qnew -f test.patch
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    54
  $ hg status
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    55
  $ hg qpop
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    56
  popping test.patch
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    57
  patch queue now empty
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    58
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    59
st should not output anything
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    60
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    61
  $ hg status
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    62
  $ hg qpush
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    63
  applying test.patch
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    64
  now at: test.patch
9855
f47c0881b16e inotify: Do not access inotify when dirstate is dirty (issue1811)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff changeset
    65
12452
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    66
st should not output anything
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    67
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    68
  $ hg status
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    69
  $ hg qrefresh
f727db60abb4 tests: unify test-inotify-dirty-dirstate
Matt Mackall <mpm@selenic.com>
parents: 9897
diff changeset
    70
  $ hg status
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
    71
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
    72
  $ cd ..