chiark / gitweb /
changelog: start 7.1~
[dgit.git] / tests / tests / gdr-newupstream
index 0724459ea8fc9a9dbfbc83eb61dcf50d45634ef6..30396691912872c8fd03cf91c9a4c942c5981379 100755 (executable)
@@ -26,8 +26,35 @@ t-git-debrebase new-upstream $v
 
 git tag v2.1 upstream
 
+git branch before-new-upstream
+
+clog-check-1 () {
+       before=$1
+       date=$(git log --format=%aD -n1 debian/changelog)
+       date=$(date -R -d "$date")
+       git show $before:debian/changelog >../clog.before
+       m="  * Update to new upstream version ${v%-*}."
+       e="dgit test git user <dgit-test@debian.example.net>  $date"
+}
+clog-check-2 () {
+       diff -u ../clog.expected debian/changelog
+}
+
+: ----- ordinary new upstream test -----
+
 t-git-debrebase new-upstream ${v%-*}
 
+clog-check-1 before-new-upstream
+cat - <<END ../clog.before >../clog.expected
+example ($v) UNRELEASED; urgency=medium
+
+$m
+
+ -- $e
+
+END
+clog-check-2
+
 t-gdr-good laundered
 git reflog | egrep 'debrebase new-upstream.*checkout'
 
@@ -36,9 +63,9 @@ t-gdr-good stitched
 
 git branch ordinary
 
-: 'with --anchor'
+: ----- 'with --anchor' -----
 
-git reset --hard startpoint
+git checkout -b with-anchor startpoint
 
 t-git-debrebase analyse >../anal.anch
 anchor=$(perl <../anal.anch -ne '
@@ -58,4 +85,25 @@ t-gdr-good stitched
 
 git diff --quiet ordinary
 
+: ----- with pre-existing changes -----
+
+git checkout -b with-preexisting before-new-upstream
+
+t-dch-commit drivel-in-changelog
+git branch before-new-upstream-with-changes
+
+t-git-next-date
+
+t-git-debrebase new-upstream ${v%-*}
+
+clog-check-1 before-new-upstream-with-changes
+perl -pe <../clog.before >../clog.expected '
+       BEGIN { ($m,$e,@ARGV) = @ARGV; }
+       next unless 1..m/^ --/;
+       s/\([^()]+\)/('$v')/ if m/^example /;
+       $_ .= "$m\n" if m/^  \* drivel-in-changelog/;
+       $_ = " -- $e\n" if m/^ -- /;
+' "$m" "$e"
+clog-check-2
+
 t-ok