tests/test-mq-qrefresh
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 23 Aug 2007 01:48:29 -0300
changeset 5210 90d9ec0dc69d
parent 3129 f01efb4bc258
permissions -rwxr-xr-x
merge: forcefully mark files that we get from the second parent as dirty After a hg merge, we want to include in the commit all the files that we got from the second parent, so that we have the correct file-level history. To make them visible to hg commit, we try to mark them as dirty. Unfortunately, right now we can't really mark them as dirty[1] - the best we can do is to mark them as needing a full comparison of their contents, but they will still be considered clean if they happen to be identical to the version in the first parent. This changeset extends the dirstate format in a compatible way, so that we can mark a file as dirty: Right now we use a negative file size to indicate we don't have valid stat data for this entry. In practice, this size is always -1. This patch uses -2 to indicate that the entry is dirty. Older versions of hg won't choke on this dirstate, but they may happily mark the file as clean after a full comparison, destroying all of our hard work. The patch adds a dirstate.normallookup method with the semantics of the current normaldirty, and changes normaldirty to forcefully mark the entry as dirty. This should fix issue522. [1] - well, we could put them in state 'm', but that state has a different meaning.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3129
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     1
#!/bin/sh
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     2
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     4
echo "mq=" >> $HGRCPATH
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     5
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     6
echo % init
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     7
hg init a
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     8
cd a
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     9
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    10
echo % commit
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    11
mkdir 1 2
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    12
echo 'base' > 1/base
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    13
echo 'base' > 2/base
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    14
hg ci -Ambase -d '1 0'
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    15
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    16
echo % qnew mqbase
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    17
hg qnew -mmqbase mqbase
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    18
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    19
echo % qrefresh
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    20
echo 'patched' > 1/base
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    21
echo 'patched' > 2/base
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    22
hg qrefresh
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    23
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    24
echo % qdiff
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    25
hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    26
               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    27
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    28
echo % qdiff dirname
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    29
hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    30
                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    31
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    32
echo % patch file contents
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    33
cat .hg/patches/mqbase | \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    34
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    35
    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    36
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    37
echo % qrefresh 1
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    38
echo 'patched again' > base
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    39
hg qrefresh 1
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    40
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    41
echo % qdiff
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    42
hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    43
               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    44
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    45
echo % qdiff dirname
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    46
hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    47
                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    48
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    49
echo % patch file contents
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    50
cat .hg/patches/mqbase | \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    51
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    52
    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    53
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    54
echo % qrefresh . in subdir
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    55
( cd 1 ; hg qrefresh . )
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    56
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    57
echo % qdiff
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    58
hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    59
               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    60
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    61
echo % qdiff dirname
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    62
hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    63
                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    64
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    65
echo % patch file contents
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    66
cat .hg/patches/mqbase | \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    67
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    68
    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    69
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    70
echo % qrefresh in hg-root again
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    71
hg qrefresh
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    72
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    73
echo % qdiff
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    74
hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    75
               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    76
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    77
echo % qdiff dirname
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    78
hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    79
                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    80
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    81
echo % patch file contents
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    82
cat .hg/patches/mqbase | \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    83
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
f01efb4bc258 tests: add new test; test-mq-qrefresh
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    84
    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"