mercurial/patch.py
changeset 4484 c927c568a5ad
parent 4482 62019c4427e3
parent 4440 eff2eefdb65a
child 4492 b79cdb7f0597
equal deleted inserted replaced
4483:a11e13d50645 4484:c927c568a5ad
    53         message = msg['Subject']
    53         message = msg['Subject']
    54         user = msg['From']
    54         user = msg['From']
    55         # should try to parse msg['Date']
    55         # should try to parse msg['Date']
    56         date = None
    56         date = None
    57         nodeid = None
    57         nodeid = None
       
    58         branch = None
    58         parents = []
    59         parents = []
    59 
    60 
    60         if message:
    61         if message:
    61             if message.startswith('[PATCH'):
    62             if message.startswith('[PATCH'):
    62                 pend = message.find(']')
    63                 pend = message.find(']')
    97                         if line.startswith('# User '):
    98                         if line.startswith('# User '):
    98                             user = line[7:]
    99                             user = line[7:]
    99                             ui.debug('From: %s\n' % user)
   100                             ui.debug('From: %s\n' % user)
   100                         elif line.startswith("# Date "):
   101                         elif line.startswith("# Date "):
   101                             date = line[7:]
   102                             date = line[7:]
       
   103                         elif line.startswith("# Branch "):
       
   104                             branch = line[9:]
   102                         elif line.startswith("# Node ID "):
   105                         elif line.startswith("# Node ID "):
   103                             nodeid = line[10:]
   106                             nodeid = line[10:]
   104                         elif line.startswith("# Parent "):
   107                         elif line.startswith("# Parent "):
   105                             parents.append(line[10:])
   108                             parents.append(line[10:])
   106                     elif line == '---' and 'git-send-email' in msg['X-Mailer']:
   109                     elif line == '---' and 'git-send-email' in msg['X-Mailer']:
   121         raise
   124         raise
   122 
   125 
   123     tmpfp.close()
   126     tmpfp.close()
   124     if not diffs_seen:
   127     if not diffs_seen:
   125         os.unlink(tmpname)
   128         os.unlink(tmpname)
   126         return None, message, user, date, None, None, None
   129         return None, message, user, date, branch, None, None, None
   127     p1 = parents and parents.pop(0) or None
   130     p1 = parents and parents.pop(0) or None
   128     p2 = parents and parents.pop(0) or None
   131     p2 = parents and parents.pop(0) or None
   129     return tmpname, message, user, date, nodeid, p1, p2
   132     return tmpname, message, user, date, branch, nodeid, p1, p2
   130 
   133 
   131 GP_PATCH  = 1 << 0  # we have to run patch
   134 GP_PATCH  = 1 << 0  # we have to run patch
   132 GP_FILTER = 1 << 1  # there's some copy/rename operation
   135 GP_FILTER = 1 << 1  # there's some copy/rename operation
   133 GP_BINARY = 1 << 2  # there's a binary patch
   136 GP_BINARY = 1 << 2  # there's a binary patch
   134 
   137