comparison hgext/mq.py @ 4911:fc502517d68d

mq: autodetect an existing git patch during qrefresh (issue 491)
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 16 Jul 2007 16:50:47 -0700
parents 2ececafa5859
children 8535c1770dd3 06154aff2b1a 5bbbd1f1d586
comparison
equal deleted inserted replaced
4910:22fcd6444ad9 4911:fc502517d68d
907 top = revlog.bin(top) 907 top = revlog.bin(top)
908 cparents = repo.changelog.parents(top) 908 cparents = repo.changelog.parents(top)
909 patchparent = self.qparents(repo, top) 909 patchparent = self.qparents(repo, top)
910 message, comments, user, date, patchfound = self.readheaders(patchfn) 910 message, comments, user, date, patchfound = self.readheaders(patchfn)
911 911
912 patchf = self.opener(patchfn, "w") 912 patchf = self.opener(patchfn, 'r+')
913
914 # if the patch was a git patch, refresh it as a git patch
915 for line in patchf:
916 if line.startswith('diff --git'):
917 self.diffopts().git = True
918 break
919 patchf.seek(0)
920 patchf.truncate()
921
913 msg = opts.get('msg', '').rstrip() 922 msg = opts.get('msg', '').rstrip()
914 if msg: 923 if msg:
915 if comments: 924 if comments:
916 # Remove existing message. 925 # Remove existing message.
917 ci = 0 926 ci = 0