[darcs_send_changes.py] initialise correctement le repo darcs lorsque celui-ci ne l'est pas

darcs-hash:20081218010143-bd074-097df06a0e7d7a21a6d0b537a586af692d58e25f.gz
This commit is contained in:
Antoine Durand-Gasselin 2008-12-18 02:01:43 +01:00
parent 9982f1286e
commit d8b4c7de91

View file

@ -91,7 +91,9 @@ def get_patch_properties(hash):
if os.path.exists(ID_FILE): if os.path.exists(ID_FILE):
id = file(ID_FILE).read().strip() id = file(ID_FILE).read().strip()
else: else:
id = shortrepo # Ne devrait jamais être appelé
import socket
id = "%s:%s" % (socket.gethostname(), shortrepo)
return { 'author': prop.attrib['author'], return { 'author': prop.attrib['author'],
'hostname': hostname, 'hostname': hostname,
'id': id, 'id': id,
@ -290,6 +292,18 @@ if __name__ == "__main__":
cprint("Pas de dépôt darcs trouvé") cprint("Pas de dépôt darcs trouvé")
sys.exit(1) sys.exit(1)
if not os.path.exists(CONF_PATH):
partial_path = ''
for rep in CONF_PATH.split('/'):
partial_path += rep+'/'
if not os.path.exists(partial_path):
os.mkdir(os.path.realpath(partial_path))
if not os.path.exists(ID_FILE):
import socket
open(ID_FILE, "w" ).write("%s:%s" % (socket.gethostname(), os.path.basename(os.getcwd())))
if not os.path.exists(DATE_FILE): if not os.path.exists(DATE_FILE):
try: try:
# Sélection du patch façon darcs # Sélection du patch façon darcs
@ -302,8 +316,6 @@ if __name__ == "__main__":
patches = getnew(lastdate) patches = getnew(lastdate)
if c == "none": if c == "none":
if patches: if patches:
if not os.path.exists(CONF_PATH):
os.mkdir(CONF_PATH)
open(DATE_FILE, "w").write(patches[-1].split("-", 1)[0]) open(DATE_FILE, "w").write(patches[-1].split("-", 1)[0])
patches = [] patches = []
else: else: