Source

hgbook / fr / examples / template.simple

#!/bin/bash

# So many different bits of random output, it would be a nightmare to
# ignore each individually.
#$ ignore: .*

hg init myrepo
cd myrepo
echo hello > hello
hg commit -Am'added hello'

echo hello >> hello
echo goodbye > goodbye
echo '   added line to end of <<hello>> file.' > ../msg
echo '' >> ../msg
echo 'in addition, added a file with the helpful name (at least i hope that some might consider it so) of goodbye.' >> ../msg

hg commit -Al../msg

hg tag mytag
hg tag v0.1

#$ name: normal

hg log -r1

#$ name: compact

hg log --style compact

#$ name: changelog

hg log --style changelog

#$ name: simplest

hg log -r1 --template 'i saw a changeset\n'

#$ name: simplesub

hg log --template 'i saw a changeset: {desc}\n'

#$ name: keywords

hg log -r1 --template 'author: {author}\n'
hg log -r1 --template 'desc:\n{desc}\n'
hg log -r1 --template 'files: {files}\n'
hg log -r1 --template 'file_adds: {file_adds}\n'
hg log -r1 --template 'file_dels: {file_dels}\n'
hg log -r1 --template 'node: {node}\n'
hg log -r1 --template 'parents: {parents}\n'
hg log -r1 --template 'rev: {rev}\n'
hg log -r1 --template 'tags: {tags}\n'

#$ name: datekeyword

hg log -r1 --template 'date: {date}\n'
hg log -r1 --template 'date: {date|isodate}\n'

#$ name: manyfilters

hg log -r1 --template '{author}\n'
hg log -r1 --template '{author|domain}\n'
hg log -r1 --template '{author|email}\n'
hg log -r1 --template '{author|obfuscate}\n' | cut -c-76
hg log -r1 --template '{author|person}\n'
hg log -r1 --template '{author|user}\n'

hg log -r1 --template 'looks almost right, but actually garbage: {date}\n'
hg log -r1 --template '{date|age}\n'
hg log -r1 --template '{date|date}\n'
hg log -r1 --template '{date|hgdate}\n'
hg log -r1 --template '{date|isodate}\n'
hg log -r1 --template '{date|rfc822date}\n'
hg log -r1 --template '{date|shortdate}\n'

hg log -r1 --template '{desc}\n' | cut -c-76
hg log -r1 --template '{desc|addbreaks}\n' | cut -c-76
hg log -r1 --template '{desc|escape}\n' | cut -c-76
hg log -r1 --template '{desc|fill68}\n'
hg log -r1 --template '{desc|fill76}\n'
hg log -r1 --template '{desc|firstline}\n'
hg log -r1 --template '{desc|strip}\n' | cut -c-76
hg log -r1 --template '{desc|tabindent}\n' | expand | cut -c-76

hg log -r1 --template '{node}\n'
hg log -r1 --template '{node|short}\n'

#$ name: combine

hg log -r1 --template 'description:\n\t{desc|strip|fill68|tabindent}\n'

#$ name: rev

echo 'changeset = "rev: {rev}\n"' > rev
hg log -l1 --style ./rev
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.