hgext/mq.py
branchstable
changeset 10186 296a0b14a686
parent 10185 7637fe4f525d
child 10187 fcc15ba18c03
child 10188 fd6e9c7cd98c
child 10263 25e572394f5c
equal deleted inserted replaced
10185:7637fe4f525d 10186:296a0b14a686
   262         diffopts = patch.diffopts(self.ui, opts)
   262         diffopts = patch.diffopts(self.ui, opts)
   263         if patchfn:
   263         if patchfn:
   264             diffopts = self.patchopts(diffopts, patchfn)
   264             diffopts = self.patchopts(diffopts, patchfn)
   265         return diffopts
   265         return diffopts
   266 
   266 
   267     def patchopts(self, diffopts, patchfn):
   267     def patchopts(self, diffopts, *patches):
   268         """Return a copy of input diff options with git set to true if
   268         """Return a copy of input diff options with git set to true if
   269         referenced patch is a git patch.
   269         referenced patch is a git patch.
   270         """
   270         """
   271         diffopts = diffopts.copy()
   271         diffopts = diffopts.copy()
   272         patchf = self.opener(patchfn, 'r')
   272         for patchfn in patches:
   273         # if the patch was a git patch, refresh it as a git patch
   273             patchf = self.opener(patchfn, 'r')
   274         for line in patchf:
   274             # if the patch was a git patch, refresh it as a git patch
   275             if line.startswith('diff --git'):
   275             for line in patchf:
   276                 diffopts.git = True
   276                 if line.startswith('diff --git'):
   277                 break
   277                     diffopts.git = True
   278         patchf.close()
   278                     break
       
   279             patchf.close()
   279         return diffopts
   280         return diffopts
   280 
   281 
   281     def join(self, *p):
   282     def join(self, *p):
   282         return os.path.join(self.path, *p)
   283         return os.path.join(self.path, *p)
   283 
   284 
  2068         message = '\n'.join(message)
  2069         message = '\n'.join(message)
  2069 
  2070 
  2070     if opts['edit']:
  2071     if opts['edit']:
  2071         message = ui.edit(message, user or ui.username())
  2072         message = ui.edit(message, user or ui.username())
  2072 
  2073 
  2073     q.refresh(repo, msg=message)
  2074     diffopts = q.patchopts(q.diffopts(), *patches)
       
  2075     q.refresh(repo, msg=message, git=diffopts.git)
  2074     q.delete(repo, patches, opts)
  2076     q.delete(repo, patches, opts)
  2075     q.save_dirty()
  2077     q.save_dirty()
  2076 
  2078 
  2077 def goto(ui, repo, patch, **opts):
  2079 def goto(ui, repo, patch, **opts):
  2078     '''push or pop patches until named patch is at top of stack'''
  2080     '''push or pop patches until named patch is at top of stack'''