94
94
# revision: The revision number to update to. If not provided this
95
95
# defaults to HEAD.
97
# action=svnpublish: Set the "published" flag on a file to True.
98
# path: The path to the file to be published. Can be specified
101
# action=svnunpublish: Set the "published" flag on a file to False.
102
# path: The path to the file to be unpublished. Can be specified
97
105
# action=svncommit: Commit a file(s) or directory(s) to the repository.
98
106
# path: The path to the file or directory to be committed. Can be
99
107
# specified multiple times. Directories are committed
318
326
frompath = fields.getfirst('from')
319
327
topath = fields.getfirst('to')
320
svn = fields.getfirst('svn')
322
svn_movefile(req, frompath, topath)
324
movefile(req, frompath, topath)
328
movefile(req, frompath, topath)
326
330
def action_mkdir(req, fields):
327
331
"""Creates a directory with the given path.
576
580
Reads fields: 'path' (multiple)
578
582
paths = fields.getlist('path')
579
paths = map(lambda path: actionpath_to_local(req, path).decode('utf-8'),
583
paths = map(lambda path: actionpath_to_local(req, path), paths)
583
586
svnclient.add(paths, recurse=True, force=True)
590
593
Reads fields: 'path' (multiple)
592
595
paths = fields.getlist('path')
593
paths = map(lambda path: actionpath_to_local(req, path).decode('utf-8'),
596
paths = map(lambda path: actionpath_to_local(req, path), paths)
597
599
svnclient.remove(paths, force=True)
643
645
Reads fields: 'path' (multiple)
645
647
paths = fields.getlist('path')
646
paths = map(lambda path: actionpath_to_local(req, path).decode('utf-8'),
648
paths = map(lambda path: actionpath_to_local(req, path), paths)
650
651
svnclient.revert(paths, recurse=True)
651
652
except pysvn.ClientError, e:
652
653
raise ActionError(str(e))
655
def action_svnpublish(req, fields):
656
"""Sets svn property "ivle:published" on each file specified.
657
Should only be called on directories (only effective on directories
662
XXX Currently unused by the client (calls action_publish instead, which
663
has a completely different publishing model).
665
paths = fields.getlist('path')
667
paths = map(lambda path: actionpath_to_local(req, path), paths)
669
paths = [studpath.to_home_path(req.path)]
673
# Note: Property value doesn't matter
674
svnclient.propset("ivle:published", "", path, recurse=False)
675
except pysvn.ClientError, e:
676
raise ActionError("Directory could not be published")
678
def action_svnunpublish(req, fields):
679
"""Deletes svn property "ivle:published" on each file specified.
683
XXX Currently unused by the client (calls action_unpublish instead, which
684
has a completely different publishing model).
686
paths = fields.getlist('path')
687
paths = map(lambda path: actionpath_to_local(req, path), paths)
691
svnclient.propdel("ivle:published", path, recurse=False)
692
except pysvn.ClientError, e:
693
raise ActionError("Directory could not be unpublished")
654
695
def action_svncommit(req, fields):
655
696
"""Performs a "svn commit" to each file specified.
657
698
Reads fields: 'path' (multiple), 'logmsg' (optional)
659
700
paths = fields.getlist('path')
661
paths = map(lambda path:actionpath_to_local(req,path).decode('utf-8'),
664
paths = [studpath.to_home_path(req.path).decode('utf-8')]
665
logmsg = str(fields.getfirst('logmsg',
666
DEFAULT_LOGMESSAGE)).decode('utf-8')
701
paths = map(lambda path: actionpath_to_local(req, str(path)), paths)
702
logmsg = str(fields.getfirst('logmsg', DEFAULT_LOGMESSAGE))
667
703
if logmsg == '': logmsg = DEFAULT_LOGMESSAGE
681
717
raise ActionError("usage: svncheckout url local-path")
682
718
url = ivle.conf.svn_addr + "/" + urllib.quote(paths[0])
683
719
local_path = actionpath_to_local(req, str(paths[1]))
684
url = url.decode('utf-8')
685
local_path = local_path.decode('utf-8')
687
721
svnclient.checkout(url, local_path, recurse=True)
688
722
except pysvn.ClientError, e:
762
795
"svnupdate" : action_svnupdate,
763
796
"svnresolved" : action_svnresolved,
764
797
"svnrevert" : action_svnrevert,
798
"svnpublish" : action_svnpublish,
799
"svnunpublish" : action_svnunpublish,
765
800
"svncommit" : action_svncommit,
766
801
"svncheckout" : action_svncheckout,
767
802
"svnrepomkdir" : action_svnrepomkdir,