tests/test-rebuildstate.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 02 Jun 2015 02:28:33 +0900
branchstable
changeset 25392 ed18f4acf435
parent 23840 ddc17eaf0f1b
child 27174 9fbe3545e4bd
permissions -rw-r--r--
templatekw: compare target context and its parent exactly (issue4690) Before this patch, template keywords `{file_mods}`, `{file_adds}` and `{file_dels}` use values gotten by `repo.status(ctx.p1().node(), ctx.node())`. But this doesn't work as expected if `ctx` is `memctx` or `workingcommitctx`. Typical case of templating with these contexts is customization of the text shown in the commit message editor by `[committemplate]` configuration. In this case, `ctx.node()` returns None and it causes comparison between `ctx.p1()` and `workingctx`. `workingctx` lists up all changed files in the working directory even at selective committing. BTW, `{files}` uses `ctx.files()` and it works as expected. To compare target context and its parent exactly, this patch passes `ctx.p1()` and `ctx` without `node()`-nize. This avoids unexpected comparison with `workingctx`. This patch uses a little redundant template configurations in `test-commit.t`, but they are needed to avoid regression around problems fixed by a4958cdb2202 and 1e6fb8db666e: accessing on `ctx` may break `ctx._status` field.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12121
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     1
basic test for hg debugrebuildstate
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     2
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     3
  $ hg init repo
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     4
  $ cd repo
5065
b304c2496f52 dirstate: fix rebuild; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
12121
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     6
  $ touch foo bar
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     7
  $ hg ci -Am 'add foo bar'
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     8
  adding bar
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
     9
  adding foo
5065
b304c2496f52 dirstate: fix rebuild; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
12121
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    11
  $ touch baz
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    12
  $ hg add baz
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    13
  $ hg rm bar
5065
b304c2496f52 dirstate: fix rebuild; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
12121
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    15
  $ hg debugrebuildstate
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    16
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    17
state dump after
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    18
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    19
  $ hg debugstate --nodates | sort
23840
ddc17eaf0f1b debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents: 16913
diff changeset
    20
  n 644         -1 set                 bar
ddc17eaf0f1b debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
Mads Kiilerich <madski@unity3d.com>
parents: 16913
diff changeset
    21
  n 644         -1 set                 foo
5065
b304c2496f52 dirstate: fix rebuild; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
12121
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    23
status
5065
b304c2496f52 dirstate: fix rebuild; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
12121
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    25
  $ hg st -A
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    26
  ! bar
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    27
  ? baz
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    28
  C foo
8f258dd4ed02 tests: unify test-rebuildstate
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 6344
diff changeset
    29
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 15440
diff changeset
    30
  $ cd ..