From cdebac0b131a8e52ea3d3327d7731d511fc581c6 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Sat, 15 Jan 2011 01:02:22 +0100 Subject: [PATCH 1/9] The commit object's diff member changed from "changes" to "diff" so the "dowload the corresponding diff file" link was broken. --- src/IDF/Views/Source.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index a0748da..472d710 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -342,7 +342,7 @@ class IDF_Views_Source if (!$cobject) { throw new Exception('could not retrieve commit object for '. $commit); } - $rep = new Pluf_HTTP_Response($cobject->changes, 'text/plain'); + $rep = new Pluf_HTTP_Response($cobject->diff, 'text/plain'); $rep->headers['Content-Disposition'] = 'attachment; filename="'.$commit.'.diff"'; return $rep; } From d445a65788201aced3ddf64bda2b9588db60d15e Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Mon, 17 Jan 2011 01:20:33 +0100 Subject: [PATCH 2/9] Beef up the branch and tag lists as per issue 601 - currently only for the monotone plugin's source view. --- src/IDF/templates/idf/base-full.html | 1 + src/IDF/templates/idf/base-simple.html | 1 + src/IDF/templates/idf/base.html | 1 + .../templates/idf/source/mtn/changelog.html | 35 +++++--- src/IDF/templates/idf/source/mtn/commit.html | 36 ++++---- src/IDF/templates/idf/source/mtn/tree.html | 35 +++++--- www/media/idf/css/style.css | 81 ++++++++++++++++++ www/media/idf/img/white_gradient.png | Bin 0 -> 201 bytes 8 files changed, 147 insertions(+), 43 deletions(-) create mode 100644 www/media/idf/img/white_gradient.png diff --git a/src/IDF/templates/idf/base-full.html b/src/IDF/templates/idf/base-full.html index 5f505d8..d2e69fa 100644 --- a/src/IDF/templates/idf/base-full.html +++ b/src/IDF/templates/idf/base-full.html @@ -69,6 +69,7 @@
{block foot}{/block}
{include 'idf/js-hotkeys.html'} +{include 'idf/list-filter.html'} {block javascript}{/block} {if $project} From caac97926355becf2ad0d596489b475e48b922d1 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Mon, 17 Jan 2011 11:57:39 +0100 Subject: [PATCH 4/9] Don't throw an exception in case we do not find a branch cert tacked on a revision from which we want to start our log from, but simply ignore that and go over to the next revision. Note that this is also a bit fragile and should probably be converted to plain mtn au log usage. --- src/IDF/Scm/Monotone.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/IDF/Scm/Monotone.php b/src/IDF/Scm/Monotone.php index fb39d5b..39e2fc2 100644 --- a/src/IDF/Scm/Monotone.php +++ b/src/IDF/Scm/Monotone.php @@ -749,10 +749,9 @@ class IDF_Scm_Monotone extends IDF_Scm // read in the initial branches we should follow if (count($initialBranches) == 0) { if (!isset($certs['branch'])) { - throw new IDF_Scm_Exception(sprintf( - __("revision %s has no branch cert - cannot start ". - "logging from this revision"), $rev - )); + // this revision has no branch cert, we cannot start logging + // from this revision + continue; } $initialBranches = $certs['branch']; } From 74baebde96b453039018025bbb95f2b60a93914f Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Tue, 18 Jan 2011 15:43:35 +0100 Subject: [PATCH 5/9] I changed my mind: remote automate access should be prevented for private projects and we should also take care that the symlink that enables it is dynamically created / removed when the private flag changes for a project. --- doc/syncmonotone.mdtext | 9 ++++---- src/IDF/Plugin/SyncMonotone.php | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/doc/syncmonotone.mdtext b/doc/syncmonotone.mdtext index c21a325..4a25b50 100644 --- a/doc/syncmonotone.mdtext +++ b/doc/syncmonotone.mdtext @@ -187,10 +187,11 @@ Remote commands can be helpful for a user or a 3rd party tool (like contents remotely without having to pull everything in first instance. Private projects on the other hand can only be synced by team members -or additional invited people. Remote command execution is still enabled -by default - if you want to disable that, simply remove the symlink to -the file `indefero_authorize_remote_automate.conf` in your project's `hooks.d` -directory or copy the file from the original location and adapt it. +or additional invited people. Remote command execution is disabled +by default. If you want to enable that, simply put the keys of the users +you want to give access to in your project's `remote-automate-permissions` +file. In the future this plugin might handle this file just as it handles +`read-permissions` and `write-permissions`. ## Notifications diff --git a/src/IDF/Plugin/SyncMonotone.php b/src/IDF/Plugin/SyncMonotone.php index f75f530..bc12e2a 100644 --- a/src/IDF/Plugin/SyncMonotone.php +++ b/src/IDF/Plugin/SyncMonotone.php @@ -117,6 +117,12 @@ class IDF_Plugin_SyncMonotone 'hooks.d/indefero_post_push.conf.in', 'hooks.d/indefero_post_push.lua', ); + if (!$project->private) { + // this is linked and not copied to be able to update + // the list of read-only commands on upgrades + $confdir_contents[] = 'hooks.d/indefero_authorize_remote_automate.conf'; + } + // check whether we should handle additional files in the config directory $confdir_extra_contents = Pluf::f('mtn_confdir_extra', false); if ($confdir_extra_contents !== false) { @@ -383,6 +389,41 @@ class IDF_Plugin_SyncMonotone __('Could not write read-permissions file "%s"'), $rcfile )); } + + // link / unlink the read-only automate permissions for the project + $confdir = Pluf::f('mtn_confdir', false); + if ($confdir === false) { + $confdir = dirname(__FILE__).'/SyncMonotone/'; + } + $file = 'hooks.d/indefero_authorize_remote_automate.conf'; + $projectfile = $projectpath.'/'.$file; + $templatefile = $confdir.'/'.$file; + + $serverRestartRequired = false; + if ($project->private && file_exists($projectfile) && is_link($projectfile)) { + if (!unlink($projectfile)) { + IDF_Scm_Exception(sprintf( + __('Could not remove symlink "%s"'), $projectfile + )); + } + $serverRestartRequired = true; + } else + if (!$project->private && !file_exists($projectfile)) { + if (!symlink($templatefile, $projectfile)) { + throw new IDF_Scm_Exception(sprintf( + __('Could not create symlink "%s"'), $projectfile + )); + } + $serverRestartRequired = true; + } + + if ($serverRestartRequired) { + // FIXME: we should actually use stopServer() here, but this + // seems to be ignored when the server should be started + // again immediately afterwards + IDF_Scm_Monotone_Usher::killServer($project->shortname); + IDF_Scm_Monotone_Usher::startServer($project->shortname); + } } /** From a489cb15b5348cb5d80d3851c584c81f7a13a55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20d=27Anterroches?= Date: Thu, 20 Jan 2011 10:25:41 +0100 Subject: [PATCH 6/9] Added the display of the merge history in a commit view. --- src/IDF/Scm/Git.php | 8 +++++++- src/IDF/templates/idf/source/commit.html | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index edc1aab..90954b8 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -27,7 +27,7 @@ */ class IDF_Scm_Git extends IDF_Scm { - public $mediumtree_fmt = 'commit %H%nAuthor: %an <%ae>%nTree: %T%nDate: %ai%n%n%s%n%n%b'; + public $mediumtree_fmt = 'commit %H%nAuthor: %an <%ae>%nTree: %T%nParents: %P%nDate: %ai%n%n%s%n%n%b'; /* ============================================== * * * @@ -518,6 +518,9 @@ class IDF_Scm_Git extends IDF_Scm $c['full_message'] = trim($c['full_message']); $c['full_message'] = IDF_Commit::toUTF8($c['full_message']); $c['title'] = IDF_Commit::toUTF8($c['title']); + if (isset($c['parents'])) { + $c['parents'] = explode(' ', trim($c['parents'])); + } $res[] = (object) $c; } $c = array(); @@ -553,6 +556,9 @@ class IDF_Scm_Git extends IDF_Scm $c['full_message'] = !empty($c['full_message']) ? trim($c['full_message']) : ''; $c['full_message'] = IDF_Commit::toUTF8($c['full_message']); $c['title'] = IDF_Commit::toUTF8($c['title']); + if (isset($c['parents'])) { + $c['parents'] = explode(' ', trim($c['parents'])); + } $res[] = (object) $c; return $res; } diff --git a/src/IDF/templates/idf/source/commit.html b/src/IDF/templates/idf/source/commit.html index 18b822f..4c5814e 100644 --- a/src/IDF/templates/idf/source/commit.html +++ b/src/IDF/templates/idf/source/commit.html @@ -15,6 +15,12 @@ {trans 'Commit:'}{$cobject.commit} +{if $cobject.parents} +{trans 'Parents:'}{foreach $cobject.parents as $parent} +{$parent}
+{/foreach} + +{/if} {trans 'Message:'}{issuetext $cobject.title, $request}{if isset($cobject.full_message)}

{issuetext $cobject.full_message, $request, true, false, true, true, true}{/if} {if count($changes)} From 77ba17eb61e44f8fa410a7cdf76d19b8fa9b2cfe Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Thu, 20 Jan 2011 23:40:21 +0100 Subject: [PATCH 7/9] Remove commented-out, unneeded manual includes --- src/IDF/Scm/Monotone.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/IDF/Scm/Monotone.php b/src/IDF/Scm/Monotone.php index 39e2fc2..45a256c 100644 --- a/src/IDF/Scm/Monotone.php +++ b/src/IDF/Scm/Monotone.php @@ -21,9 +21,6 @@ # # ***** END LICENSE BLOCK ***** */ -//require_once(dirname(__FILE__) . "/Monotone/Stdio.php"); -//require_once(dirname(__FILE__) . "/Monotone/BasicIO.php"); - /** * Monotone scm class * From 296091e977a80076950399fd7ecf4adb48989365 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Thu, 20 Jan 2011 23:45:21 +0100 Subject: [PATCH 8/9] Fetch parent revisions for monotone commits as well. --- src/IDF/Scm/Monotone.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/IDF/Scm/Monotone.php b/src/IDF/Scm/Monotone.php index 45a256c..5166915 100644 --- a/src/IDF/Scm/Monotone.php +++ b/src/IDF/Scm/Monotone.php @@ -674,8 +674,12 @@ class IDF_Scm_Monotone extends IDF_Scm if (count($revs) == 0) return array(); - $certs = $this->_getCerts($revs[0]); + $res = array(); + $parents = $this->stdio->exec(array('parents', $revs[0])); + $res['parents'] = preg_split("/\n/", $parents, -1, PREG_SPLIT_NO_EMPTY); + + $certs = $this->_getCerts($revs[0]); // FIXME: this assumes that author, date and changelog are always given $res['author'] = implode(', ', $certs['author']); From 207eb1322d5dc99dd091b4ddc8be064aececdfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20d=27Anterroches?= Date: Mon, 24 Jan 2011 11:53:24 +0100 Subject: [PATCH 9/9] Fixed to correctly store utf-8 string in the git cache. --- src/IDF/Commit.php | 2 +- src/IDF/Scm/Cache/Git.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/IDF/Commit.php b/src/IDF/Commit.php index 70414aa..cf779f6 100644 --- a/src/IDF/Commit.php +++ b/src/IDF/Commit.php @@ -154,7 +154,7 @@ class IDF_Commit extends Pluf_Model $commit->summary = self::toUTF8($change->title); $commit->fullmessage = self::toUTF8($change->full_message); $commit->author = $scm->findAuthor($change->author); - $commit->origauthor = $change->author; + $commit->origauthor = self::toUTF8($change->author); $commit->creation_dtime = $change->date; $commit->create(); $commit->notify($project->getConf()); diff --git a/src/IDF/Scm/Cache/Git.php b/src/IDF/Scm/Cache/Git.php index dc905d4..cb32631 100644 --- a/src/IDF/Scm/Cache/Git.php +++ b/src/IDF/Scm/Cache/Git.php @@ -55,7 +55,9 @@ class IDF_Scm_Cache_Git extends Pluf_Model $cache->project = $this->_project; $cache->githash = $blob->hash; $blob->title = IDF_Commit::toUTF8($blob->title); - $cache->content = $blob->date.chr(31).$blob->author.chr(31).$blob->title; + $cache->content = IDF_Commit::toUTF8($blob->date) . chr(31) + . IDF_Commit::toUTF8($blob->author) . chr(31) + . IDF_Commit::toUTF8($blob->title); $sql = new Pluf_SQL('project=%s AND githash=%s', array($this->_project->id, $blob->hash)); if (0 == Pluf::factory(__CLASS__)->getCount(array('filter' => $sql->gen()))) {