File: changelog.sh

package info (click to toggle)
docdiff 0.5.0%2Bgit20160313-1
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 896 kB
  • ctags: 722
  • sloc: ruby: 14,138; makefile: 98; lisp: 33; sh: 26
file content (40 lines) | stat: -rwxr-xr-x 753 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# ChangeLog Generator
# Copyright 2011 Hisashi Morita
# License: Public Domain
#
# Usage:
#   changelog.sh [WORKING_DIR] > ChangeLog

if [ "$1" ]; then
  WD="$1"
else
  WD="."
fi

# Subversion
which svn >/dev/null
if [ x"$?" = x0 ]; then
  (svn info "${WD}" >/dev/null 2>&1) && SVN=TRUE
  if [ x"${SVN}" = xTRUE ]; then
    (cd "${WD}"; svn log -rBASE:0 -v)
  fi
fi

# Git
which git >/dev/null
if [ x"$?" = x0 ]; then
  (cd "${WD}" && git status --porcelain >/dev/null 2>&1) && GIT=TRUE
  if [ x"${GIT}" = xTRUE ]; then
    (cd "${WD}"; git log | cat)
  fi
fi

# Mercurial
which hg >/dev/null
if [ x"$?" = x0 ]; then
  (hg status "${WD}" >/dev/null 2>&1) && HG=TRUE
  if [ x"${HG}" = xTRUE ]; then
    (cd "${WD}"; hg log --rev tip:0)
  fi
fi