py3: use startswith() to check existence of trailing '\n' in .hgtags file
authorYuya Nishihara <yuya@tcha.org>
Thu, 01 Mar 2018 16:32:45 -0500
changeset 36572 3e458c583d2c
parent 36571 106e93d16435
child 36573 a16fceb686a7
py3: use startswith() to check existence of trailing '\n' in .hgtags file
mercurial/tags.py
--- a/mercurial/tags.py	Thu Mar 01 15:57:27 2018 -0500
+++ b/mercurial/tags.py	Thu Mar 01 16:32:45 2018 -0500
@@ -559,7 +559,7 @@
 
     def writetags(fp, names, munge, prevtags):
         fp.seek(0, 2)
-        if prevtags and prevtags[-1] != '\n':
+        if prevtags and not prevtags.endswith('\n'):
             fp.write('\n')
         for name in names:
             if munge: