tests/test-command-template.t
changeset 33858 6f6c87888b22
parent 33773 6c1a9fd8361b
child 33865 af20468eb0a4
equal deleted inserted replaced
33857:833f70277f0e 33858:6f6c87888b22
  4317 
  4317 
  4318   $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
  4318   $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
  4319   custom
  4319   custom
  4320 
  4320 
  4321   $ cd ..
  4321   $ cd ..
       
  4322 
       
  4323 Test 'graphwidth' in 'hg log' on various topologies. The key here is that the
       
  4324 printed graphwidths 3, 5, 7, etc. should all line up in their respective
       
  4325 columns. We don't care about other aspects of the graph rendering here.
       
  4326 
       
  4327   $ hg init graphwidth
       
  4328   $ cd graphwidth
       
  4329 
       
  4330   $ wrappabletext="a a a a a a a a a a a a"
       
  4331 
       
  4332   $ printf "first\n" > file
       
  4333   $ hg add file
       
  4334   $ hg commit -m "$wrappabletext"
       
  4335 
       
  4336   $ printf "first\nsecond\n" > file
       
  4337   $ hg commit -m "$wrappabletext"
       
  4338 
       
  4339   $ hg checkout 0
       
  4340   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  4341   $ printf "third\nfirst\n" > file
       
  4342   $ hg commit -m "$wrappabletext"
       
  4343   created new head
       
  4344 
       
  4345   $ hg merge
       
  4346   merging file
       
  4347   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
       
  4348   (branch merge, don't forget to commit)
       
  4349 
       
  4350   $ hg log --graph -T "{graphwidth}"
       
  4351   @  3
       
  4352   |
       
  4353   | @  5
       
  4354   |/
       
  4355   o  3
       
  4356   
       
  4357   $ hg commit -m "$wrappabletext"
       
  4358 
       
  4359   $ hg log --graph -T "{graphwidth}"
       
  4360   @    5
       
  4361   |\
       
  4362   | o  5
       
  4363   | |
       
  4364   o |  5
       
  4365   |/
       
  4366   o  3
       
  4367   
       
  4368 
       
  4369   $ hg checkout 0
       
  4370   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  4371   $ printf "third\nfirst\nsecond\n" > file
       
  4372   $ hg commit -m "$wrappabletext"
       
  4373   created new head
       
  4374 
       
  4375   $ hg log --graph -T "{graphwidth}"
       
  4376   @  3
       
  4377   |
       
  4378   | o    7
       
  4379   | |\
       
  4380   +---o  7
       
  4381   | |
       
  4382   | o  5
       
  4383   |/
       
  4384   o  3
       
  4385   
       
  4386 
       
  4387   $ hg log --graph -T "{graphwidth}" -r 3
       
  4388   o    5
       
  4389   |\
       
  4390   ~ ~
       
  4391 
       
  4392   $ hg log --graph -T "{graphwidth}" -r 1
       
  4393   o  3
       
  4394   |
       
  4395   ~
       
  4396 
       
  4397   $ hg merge
       
  4398   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  4399   (branch merge, don't forget to commit)
       
  4400   $ hg commit -m "$wrappabletext"
       
  4401 
       
  4402   $ printf "seventh\n" >> file
       
  4403   $ hg commit -m "$wrappabletext"
       
  4404 
       
  4405   $ hg log --graph -T "{graphwidth}"
       
  4406   @  3
       
  4407   |
       
  4408   o    5
       
  4409   |\
       
  4410   | o  5
       
  4411   | |
       
  4412   o |    7
       
  4413   |\ \
       
  4414   | o |  7
       
  4415   | |/
       
  4416   o /  5
       
  4417   |/
       
  4418   o  3
       
  4419   
       
  4420 
       
  4421 The point of graphwidth is to allow wrapping that accounts for the space taken
       
  4422 by the graph.
       
  4423 
       
  4424   $ COLUMNS=10 hg log --graph -T "{fill(desc, termwidth - graphwidth)}"
       
  4425   @  a a a a
       
  4426   |  a a a a
       
  4427   |  a a a a
       
  4428   o    a a a
       
  4429   |\   a a a
       
  4430   | |  a a a
       
  4431   | |  a a a
       
  4432   | o  a a a
       
  4433   | |  a a a
       
  4434   | |  a a a
       
  4435   | |  a a a
       
  4436   o |    a a
       
  4437   |\ \   a a
       
  4438   | | |  a a
       
  4439   | | |  a a
       
  4440   | | |  a a
       
  4441   | | |  a a
       
  4442   | o |  a a
       
  4443   | |/   a a
       
  4444   | |    a a
       
  4445   | |    a a
       
  4446   | |    a a
       
  4447   | |    a a
       
  4448   o |  a a a
       
  4449   |/   a a a
       
  4450   |    a a a
       
  4451   |    a a a
       
  4452   o  a a a a
       
  4453      a a a a
       
  4454      a a a a
       
  4455 
       
  4456 Something tricky happens when there are elided nodes; the next drawn row of
       
  4457 edges can be more than one column wider, but the graph width only increases by
       
  4458 one column. The remaining columns are added in between the nodes.
       
  4459 
       
  4460   $ hg log --graph -T "{graphwidth}" -r "0|2|4|5"
       
  4461   o    5
       
  4462   |\
       
  4463   | \
       
  4464   | :\
       
  4465   o : :  7
       
  4466   :/ /
       
  4467   : o  5
       
  4468   :/
       
  4469   o  3
       
  4470   
       
  4471 
       
  4472   $ cd ..
       
  4473