Mercurial > hg-stable
annotate tests/test-filelog.py @ 25382:6084926366b9
summary: move the parents phase marker to commit line (issue4688)
The phase of the pending commit depends on the parent of the working directory
and on the phases.newcommit configuration.
First, this information rather depend on the commit line which describe the
pending commit.
Then, we only want to be advertised when the pending phase is going to be higher
than the default new commit phase.
So the format will change from
$ hg summary
parent: 2:ab91dfabc5ad
foo
parent: 3:24f1031ad244 tip
bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge)
update: (current)
phases: 1 secret (secret)
to
parent: 2:ab91dfabc5ad
foo
parent: 3:24f1031ad244 tip
bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge) (secret)
update: (current)
phases: 1 secret
author | Gilles Moris <gilles.moris@free.fr> |
---|---|
date | Fri, 29 May 2015 22:23:58 +0200 |
parents | 2761a791b113 |
children | ce26928cbe41 |
rev | line source |
---|---|
11540
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
2 """ |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
3 Tests the behaviour of filelog w.r.t. data starting with '\1\n' |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
4 """ |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
5 from mercurial import ui, hg |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
6 from mercurial.node import nullid, hex |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
7 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
8 myui = ui.ui() |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
9 repo = hg.repository(myui, path='.', create=True) |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
10 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
11 fl = repo.file('foobar') |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
12 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
13 def addrev(text, renamed=False): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
14 if renamed: |
17486 | 15 # data doesn't matter. Just make sure filelog.renamed() returns True |
20684
2761a791b113
test-filelog: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents:
17486
diff
changeset
|
16 meta = {'copyrev': hex(nullid), 'copy': 'bar'} |
11540
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
17 else: |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
18 meta = {} |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
19 |
15876
2de1244361aa
tests: lock before creating transaction in test-filelog
Mads Kiilerich <mads@kiilerich.com>
parents:
11540
diff
changeset
|
20 lock = t = None |
11540
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
21 try: |
15876
2de1244361aa
tests: lock before creating transaction in test-filelog
Mads Kiilerich <mads@kiilerich.com>
parents:
11540
diff
changeset
|
22 lock = repo.lock() |
2de1244361aa
tests: lock before creating transaction in test-filelog
Mads Kiilerich <mads@kiilerich.com>
parents:
11540
diff
changeset
|
23 t = repo.transaction('commit') |
11540
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
24 node = fl.add(text, meta, t, 0, nullid, nullid) |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
25 return node |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
26 finally: |
15876
2de1244361aa
tests: lock before creating transaction in test-filelog
Mads Kiilerich <mads@kiilerich.com>
parents:
11540
diff
changeset
|
27 if t: |
2de1244361aa
tests: lock before creating transaction in test-filelog
Mads Kiilerich <mads@kiilerich.com>
parents:
11540
diff
changeset
|
28 t.close() |
2de1244361aa
tests: lock before creating transaction in test-filelog
Mads Kiilerich <mads@kiilerich.com>
parents:
11540
diff
changeset
|
29 if lock: |
2de1244361aa
tests: lock before creating transaction in test-filelog
Mads Kiilerich <mads@kiilerich.com>
parents:
11540
diff
changeset
|
30 lock.release() |
11540
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
31 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
32 def error(text): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
33 print 'ERROR: ' + text |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
34 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
35 textwith = '\1\nfoo' |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
36 without = 'foo' |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
37 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
38 node = addrev(textwith) |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
39 if not textwith == fl.read(node): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
40 error('filelog.read for data starting with \\1\\n') |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
41 if fl.cmp(node, textwith) or not fl.cmp(node, without): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
42 error('filelog.cmp for data starting with \\1\\n') |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
43 if fl.size(0) != len(textwith): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
44 error('FIXME: This is a known failure of filelog.size for data starting ' |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
45 'with \\1\\n') |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
46 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
47 node = addrev(textwith, renamed=True) |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
48 if not textwith == fl.read(node): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
49 error('filelog.read for a renaming + data starting with \\1\\n') |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
50 if fl.cmp(node, textwith) or not fl.cmp(node, without): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
51 error('filelog.cmp for a renaming + data starting with \\1\\n') |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
52 if fl.size(1) != len(textwith): |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
53 error('filelog.size for a renaming + data starting with \\1\\n') |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
54 |
2370e270a29a
filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
diff
changeset
|
55 print 'OK.' |