srchub

srchub Commit Details


Date:2015-07-12 17:10:26 (9 years 5 months ago)
Author:Natalie Adams
Branch:master
Commit:2a020ba09212e24f232716d92e392ef19684b7b8
Parents: fd162f97fc203bc19eb5bb0d47594e1dde2c625e
Message:Hiding mercurial repos that are private

Changes:

File differences

indefero/scripts/hgweb.cgi
55
66
77
8
89
910
1011
......
1718
1819
1920
21
22
23
24
25
2026
# Path to repo or hgweb config to serve (see 'hg help hgweb')
# config = "/path/to/repo/or/config"
import os
config = "/home/www/indefero/scripts/hgweb.config"
# Uncomment and adjust if Mercurial is not installed system-wide
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgwebdir, wsgicgi
application = hgwebdir(config)
newrepos = []
for repo in application.repos:
if not os.path.isfile(repo[1] + "/.hide"):
newrepos.append(repo)
application.repos = newrepos
wsgicgi.launch(application)
indefero/src/IDF/Plugin/SyncMercurial.php
178178
179179
180180
181
181182
182183
183184
......
216217
217218
218219
220
219221
220222
221223
......
236238
237239
238240
241
242
243
244
245
246
247
239248
240249
241250
$shortname = $project->shortname;
$hgrc_file = Pluf::f('idf_plugin_syncmercurial_path').sprintf('/%s/.hg/hgrc', $shortname);
// Get allow_push list
$allow_push = '';
$mem = $project->getMembershipData();
foreach (Pluf::factory('IDF_Project')->getList() as $project) {
$conf = new IDF_Conf();
$conf->setProject($project);
$hide_file = Pluf::f('idf_plugin_syncmercurial_path').sprintf('/%s/.hide', $project->shortname);
if ($project->private == true){
$mem = $project->getMembershipData();
$user = '';
$fcontent .= sprintf('AuthUserFile %s', Pluf::f('idf_plugin_syncmercurial_passwd_file'))."\n";
$fcontent .= sprintf('Require user %s', $user)."\n";
$fcontent .= '</Location>'."\n\n";
try {
file_put_contents($hide_file, ' ');
} catch (Exception $e) { }
} else {
try {
unlink($hide_file);
} catch (Exception $e) { }
}
}
file_put_contents($private_file, $fcontent, LOCK_EX);

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.07249s using 14 queries.