tests/test-issue522.t
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
Fri, 03 Oct 2014 19:48:56 -0400
changeset 22766 0ded0f0b1c04
parent 18631 e2dc5397bc82
child 22896 7e9cbb9c6053
permissions -rw-r--r--
log: rewrite default template to use labels (issue2866) This is a complete rewrite of the default template to use labels. This seems ultimately useless to me in most cases. The biggest benefit of this patch to me seems to be a fairly complicated example of the templating engine. It was a lot of hard work to figure out the precise acceptable syntax, since it's almost undocumented. Hat tip to Steve Losh's smartlog template, which helped me figure out a lot of the syntax. Hopefully later I can use the present default log template as an example for documenting the templating engine. A test is attached. My goal was to match the --color=debug output, which may differ slightly in newlines from the actual ANSI escape codes output. I consider this an acceptable invisible deviation. There seems to be a considerable slowdown with this rewrite. Before: $ time hg log -T default -r .~100::. > /dev/null real 0m0.882s user 0m0.812s sys 0m0.064s $ time hg log -T default -r .~100::. > /dev/null real 0m0.872s user 0m0.796s sys 0m0.068s $ time hg log -T default -r .~100::. > /dev/null real 0m0.917s user 0m0.836s sys 0m0.076s After: $ time hg log -T default -r .~100::. > /dev/null real 0m1.480s user 0m1.392s sys 0m0.072s $ time hg log -T default -r .~100::. > /dev/null real 0m1.500s user 0m1.400s sys 0m0.088s $ time hg log -T default -r .~100::. > /dev/null real 0m1.462s user 0m1.364s sys 0m0.092s Following the maxim, "make it work, profile, make it faster, in that order", I deem this slowdown acceptable for now. I suspect but have not confirmed that a big slowdown comes from calling keywords twice in the file templates, once to test the existence of output and again to actually list the output. If so, a simple speedup might be to improve the templating engine to cache keywords when called more than once on the same revision. TODO: I found a bug while working on this. The following stack traces: hg log -r . -T '{ifcontains(phase, "secret public", "lol", "omg")}\n'

http://mercurial.selenic.com/bts/issue522

In the merge below, the file "foo" has the same contents in both
parents, but if we look at the file-level history, we'll notice that
the version in p1 is an ancestor of the version in p2. This test makes
sure that we'll use the version from p2 in the manifest of the merge
revision.

  $ hg init

  $ echo foo > foo
  $ hg ci -qAm 'add foo'

  $ echo bar >> foo
  $ hg ci -m 'change foo'

  $ hg backout -r tip -m 'backout changed foo'
  reverting foo
  changeset 2:4d9e78aaceee backs out changeset 1:b515023e500e

  $ hg up -C 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ touch bar
  $ hg ci -qAm 'add bar'

  $ hg merge --debug
    searching for copies back to rev 1
    unmatched files in local:
     bar
  resolving manifests
   branchmerge: True, force: False, partial: False
   ancestor: bbd179dfa0a7, local: 71766447bdbb+, remote: 4d9e78aaceee
   foo: remote is newer -> g
  getting foo
  updating: foo 1/1 files (100.00%)
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)

  $ hg debugstate | grep foo
  n   0         -2 unset               foo

  $ hg st -A foo
  M foo

  $ hg ci -m 'merge'

  $ hg manifest --debug | grep foo
  c6fc755d7e68f49f880599da29f15add41f42f5a 644   foo

  $ hg debugindex foo
     rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
       0         0       5  .....       0 2ed2a3912a0b 000000000000 000000000000 (re)
       1         5       9  .....       1 6f4310b00b9a 2ed2a3912a0b 000000000000 (re)
       2        14       5  .....       2 c6fc755d7e68 6f4310b00b9a 000000000000 (re)