tests/test-qrecord
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Sun, 24 May 2009 18:43:05 +0900
changeset 8599 1f706b1b62f3
parent 8167 6c82beaaa11a
permissions -rwxr-xr-x
inotify: server: refactor updatestatus() * Instead of one entry point, use two entry points, updatefile() and deletefile(), both internally calling the helper function _updatestatus * Do not rely on TypeError to detect the type of oldstatus: use isinstance * The call updatestatus(wpath, None) in deleted() was a bit particular: because no osstat and no newstatus was given, the newstatus was determined using the data stored internally. To replace this exact behavior with the new code, one would use: root, fn = self.split(wpath) d = self.dir(self.tree, root) self.filedeleted(wpath, d.get(fn)) This, however, duplicates code with _updatestatus(), which led us to an interesting question: why are we basing ourselves on repowatcher data to update the status, where everywhere else, we are comparing against dirsate? There is no reason to do this, which is why the new code is: self.filedeleted(wpath, self.repo.dirstate[wpath]) Incidentally, after this, the test for issue1371 passes again.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5933
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     1
#!/bin/sh
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     2
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     3
echo "[ui]" >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     4
echo "interactive=true" >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     5
echo "[extensions]"     >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     6
echo "record="          >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     7
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     8
echo "% help (no mq, so no qrecord)"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     9
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    10
hg help qrecord
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    11
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    12
echo "mq="              >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    13
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    14
echo "% help (mq present)"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    15
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    16
hg help qrecord
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    17
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    18
hg init a
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    19
cd a
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    20
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    21
echo % base commit
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    22
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    23
cat > 1.txt <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    24
1
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    25
2
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    26
3
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    27
4
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    28
5
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    29
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    30
cat > 2.txt <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    31
a
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    32
b
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    33
c
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    34
d
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    35
e
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    36
f
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    37
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    38
mkdir dir
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    39
cat > dir/a.txt <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    40
hello world
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    41
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    42
someone
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    43
up
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    44
there
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    45
loves
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    46
me
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    47
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    48
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    49
hg add 1.txt 2.txt dir/a.txt
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 6210
diff changeset
    50
hg commit -m 'initial checkin'
5933
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    51
6210
942287cb1f57 Removed trailing spaces from everything except test output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5933
diff changeset
    52
echo % changing files
5933
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    53
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    54
sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    55
sed -e 's/b/b b/' 2.txt > 2.txt.new
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    56
sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    57
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    58
mv -f 1.txt.new 1.txt
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    59
mv -f 2.txt.new 2.txt
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    60
mv -f dir/a.txt.new dir/a.txt
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    61
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    62
echo % whole diff
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    63
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    64
hg diff --nodates
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    65
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    66
echo % qrecord a.patch
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    67
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    68
hg qrecord -d '0 0' -m aaa a.patch <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    69
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    70
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    71
n
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    72
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    73
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    74
n
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    75
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    76
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    77
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    78
echo % "after qrecord a.patch 'tip'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    79
hg tip -p
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    80
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    81
echo % "after qrecord a.patch 'diff'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    82
hg diff --nodates
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    83
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    84
echo % qrecord b.patch
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    85
hg qrecord -d '0 0' -m bbb b.patch <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    86
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    87
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    88
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    89
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    90
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    91
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    92
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    93
echo % "after qrecord b.patch 'tip'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    94
hg tip -p
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    95
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    96
echo % "after qrecord b.patch 'diff'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    97
hg diff --nodates
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    98
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    99
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
   100
echo % --- end ---