--- a/hgext/graphlog.py Wed Jul 11 15:03:10 2012 -0700
+++ b/hgext/graphlog.py Wed Jul 11 15:05:06 2012 -0700
@@ -471,7 +471,9 @@
if filematcher is not None:
revmatchfn = filematcher(ctx.rev())
displayer.show(ctx, copies=copies, matchfn=revmatchfn)
- lines = displayer.hunk.pop(rev).split('\n')[:-1]
+ lines = displayer.hunk.pop(rev).split('\n')
+ if not lines[-1]:
+ del lines[-1]
displayer.flush(rev)
edges = edgefn(type, char, lines, seen, rev, parents)
for type, char, lines, coldata in edges:
--- a/setup.py Wed Jul 11 15:03:10 2012 -0700
+++ b/setup.py Wed Jul 11 15:05:06 2012 -0700
@@ -65,6 +65,7 @@
from distutils.command.install_scripts import install_scripts
from distutils.spawn import spawn, find_executable
from distutils.ccompiler import new_compiler
+from distutils import cygwinccompiler
from distutils.errors import CCompilerError, DistutilsExecError
from distutils.sysconfig import get_python_inc
from distutils.version import StrictVersion
@@ -429,6 +430,20 @@
extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'],
extra_link_args=osutil_ldflags))
+# the -mno-cygwin option has been deprecated for years
+Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler
+
+class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
+ def __init__(self, *args, **kwargs):
+ Mingw32CCompiler.__init__(self, *args, **kwargs)
+ for i in 'compiler compiler_so linker_exe linker_so'.split():
+ try:
+ getattr(self, i).remove('-mno-cygwin')
+ except ValueError:
+ pass
+
+cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler
+
if sys.platform.startswith('linux') and os.uname()[2] > '2.6':
# The inotify extension is only usable with Linux 2.6 kernels.
# You also need a reasonably recent C library.
--- a/tests/test-glog.t Wed Jul 11 15:03:10 2012 -0700
+++ b/tests/test-glog.t Wed Jul 11 15:05:06 2012 -0700
@@ -2060,4 +2060,30 @@
[]
[]
+A template without trailing newline should do something sane
+
+ $ hg glog -r ::2 --template '{rev} {desc}'
+ o 2 mv b dir/b
+ |
+ o 1 copy a b
+ |
+
+Extra newlines must be preserved
+
+ $ hg glog -r ::2 --template '\n{rev} {desc}\n\n'
+ o
+ | 2 mv b dir/b
+ |
+ o
+ | 1 copy a b
+ |
+
+The almost-empty template should do something sane too ...
+
+ $ hg glog -r ::2 --template '\n'
+ o
+ |
+ o
+ |
+
$ cd ..