Gestion du cas où il n'y a pas encore de hash.
darcs-hash:20071216090737-af139-aa48191918f02bae8f36699f514bdcdf3b020462.gz
This commit is contained in:
parent
0a46dc2758
commit
a901082b9b
1 changed files with 10 additions and 6 deletions
|
@ -65,8 +65,12 @@ def darcs(args):
|
|||
|
||||
def get_patch_properties(hash):
|
||||
""" Récupère les informations a propos d'un certain patch. """
|
||||
prop = etree.XML(darcs("changes --match='hash %s' --xml-output" % hash))[0]
|
||||
diff = darcs("diff --match='hash %s' --unified" % hash)
|
||||
if hash:
|
||||
match_cmd = "--match='hash %s'" % hash
|
||||
else:
|
||||
match_cmd = "--last 1"
|
||||
prop = etree.XML(darcs("changes %s --xml-output" % match_cmd))[0]
|
||||
diff = darcs("diff %s --unified" % match_cmd)
|
||||
diff = diff[diff.find('\ndiff ')+1:]
|
||||
cwd = os.getcwd()
|
||||
return { 'author': prop.attrib['author'],
|
||||
|
@ -77,7 +81,7 @@ def get_patch_properties(hash):
|
|||
'name': prop.findtext('name'),
|
||||
'comment': prop.findtext('comment'),
|
||||
'diff': diff,
|
||||
'changes': darcs("changes --match='hash %s' --summary" % hash) }
|
||||
'changes': darcs("changes %s --summary" % match_cmd) }
|
||||
|
||||
def get_patches_properties(from_hash):
|
||||
""" Construit la liste des informations sur les patches à partir du patch from_hash. """
|
||||
|
@ -134,7 +138,7 @@ contenir les variables suivantes:
|
|||
texte = MIMEText(message_template % patch_props, "UTF-8")
|
||||
texte.set_charset("UTF-8")
|
||||
mail.attach(texte)
|
||||
|
||||
|
||||
patch = MIMEText(diff_template % patch_props, "UTF-8")
|
||||
patch.set_type('text/x-patch')
|
||||
patch.set_charset("UTF-8")
|
||||
|
@ -202,14 +206,14 @@ if __name__ == "__main__":
|
|||
if not os.path.exists('_darcs') and os.getcwd() == '/':
|
||||
cprint("Pas de dépôt darcs trouvé")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if not from_hash:
|
||||
if os.path.exists(LAST_SEEN_FILE):
|
||||
f = open(LAST_SEEN_FILE)
|
||||
from_hash = f.read().strip()
|
||||
f.close()
|
||||
else:
|
||||
from_hash = ""
|
||||
from_hash = None
|
||||
|
||||
patches = get_patches_properties(from_hash)
|
||||
if len(patches) == 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue