diff mercurial/tags.py @ 36543:3e458c583d2c

py3: use startswith() to check existence of trailing '\n' in .hgtags file
author Yuya Nishihara <yuya@tcha.org>
date Thu, 01 Mar 2018 16:32:45 -0500
parents a24c57f1f5c3
children f0b6fbea00cf
line wrap: on
line diff
--- 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: