Mercurial > mozilla > hg > DocumentIt
changeset 20:7299c4529b41
more improvements
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 02 Aug 2011 21:34:59 -0700 |
parents | 493683e17eae |
children | 10c5e6d11ef8 |
files | document_it.py |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/document_it.py Tue Aug 02 19:45:34 2011 -0700 +++ b/document_it.py Tue Aug 02 21:34:59 2011 -0700 @@ -74,13 +74,13 @@ raise ValueError("illegal manifest line: '%s'" % line) if '://' not in url: - url = '%s/%s' % (baseurl, url.lstrip('/')) + url = '%s%s' % (baseurl, url) filename = os.path.join(directory, f) if os.path.isdir(filename): files = all_files(filename) for i in files: relpath = os.path.relpath(i, filename) - items.append((i, '%s/%s' % (url.rstrip('/'), relpath.lstrip('/')))) + items.append((i, '%s%s' % (url.rstrip('/'), relpath.lstrip('/')))) else: items.append((filename, url)) return items @@ -109,6 +109,8 @@ help='base directory or URL of destination [DEFAULT: %default]') parser.add_option('-u', '--user', dest='user', help='user name') + parser.add_option('-p', '--password', dest='password', + help='user password') parser.add_option('--list', dest='list', action='store_true', default=False, help="list files") parser.add_option('--validate', dest='validate', # TODO unused @@ -178,11 +180,15 @@ f.write(buffer) f.close() else: - # TODO check credentials + # check credentials + assert options.user and options.password, "Please supply your --user and --password" + + # upload the files + # XXX just use curl for now + import subprocess for src, dest in files: - pass - raise NotImplementedError - + dest += '/contents?edittime=now' + print src, dest if options.dest == default_dir: print "Files rendered to\n%s" % default_dir