Repository URL backends provide the URLs for various repository related links. For example, one could select a WebSVN URL backend, enter the WebSVN root, and get all the URLs for free without having to enter them manually. Various URL backends might also provide URLs that can't be created using the default URL backend's simple string replacement mechanism.

At least, that's the theory, because the default URL backend ('versioncontrol_default_urls') is currently hardcoded. We might want to make URL backends actually pluggable sometime, although it doesn't seem like a big priority right now.

Comments

marvil07’s picture

Version: 6.x-2.x-dev » 6.x-1.0-rc2

After analysing it and talking with @jpetso, we found that pluggable url backends do not have enough reasons to be.

So at oop branch the idea of url backends dissappear.

In the other side, the functionality mentioned here is a helper, and it can be done with form alter, so it would be handy to have at least one as a reference implementation.

marvil07’s picture

Title: Make repository URL backends pluggable » Implement some url input helper
Version: 5.x-2.x-dev » 6.x-2.x-dev
marvil07’s picture

Version: 6.x-1.0-rc2 » 6.x-2.x-dev
Status: Active » Closed (duplicate)

Marking this as postponed, since IMHO this will be happening as part of converting VersioncontrolRepositoryUrlHandler into several ctools plugins \o/ #976148: Recover links to VCS web viewers and issue tracker at views

marvil07’s picture

Title: Implement some url input helper » Make repository URL backends pluggable
Priority: Minor » Normal
Status: Closed (duplicate) » Postponed
Issue tags: +git phase 2

Ok, I am moving the title back to the original, since the idea of making them pluggable come up again.

The main difference will be the approach, as mentioned in #4, but postponing this until the first ctools patch gets in: probably #979040: Make pluggable the process of mapping of raw vcs data to Drupal users

marvil07’s picture

Status: Postponed » Active
marvil07’s picture

Assigned: Unassigned » marvil07
Issue tags: +git sprint 6

have an uncompleted patch, going to post it here soon.

marvil07’s picture

Issue tags: -git sprint 6

untagging as decided today on meeting

eliza411’s picture

Priority: Normal » Major
Issue tags: +git sprint 8
marvil07’s picture

Status: Active » Needs work
StatusFileSize
new23.61 KB

Here is a patch with the general idea, it still needs some work, but uploading it since I will not be working on it for a day.

sdboyer’s picture

Sorry my review of this got delayed.

  • There's a VersioncontrolRepository::$pluginInstances property that should probably be where the instantiated viewer object gets stored, for consistency with the way other plugins operate.
  • Let's move VersioncontrolRepositoryUrlHandler into its own inc file somewhere in a way more consistent with how other comparable classes are handled.
  • I don't really like mixing in links to the commitlog here, it situates these plugins in a position awkwardly halfway between encapsulating a separate repo-browsing application entirely and log viewer functionality, which (as part of VCAPI core) has other ways to be switched around. I'd prefer to simply get rid of any methods that deal with the commit log. I guess that basically means linking to a tree browser, an individual file view, and maybe a diff view.
  • There are some var_dump()s and dpm()s in the views handler.
  • If we want to keep consistent with the interface we've been using in the repo edit form, then we may need to add in some ctools modals to manage additional configuration of the url viewer plugins. Maybe. Depends on how much conf they need, versus how much is just hard-coded into the plugin.

So apart from wanting to decouple the commitlog from the repo browser in this plugin, looks like we're pretty well on the same page. Let's see some more patches :)

marvil07’s picture

Status: Needs work » Needs review
StatusFileSize
new26.96 KB
new32.23 KB

Ok, I think this is ready.

What is new in this patch:

  • hook_update_N() to update $repository->data['versioncontrol'].
    • Remove url_handler object.
    • Add base_url string.
  • Move webviewer_url_handlers plugin documentation to an empty plugin.
  • Remove tracker url from url handler templates.
  • It is going to be re-added as a views handler option for operation
    messages.

  • Add vcs to filter webviewers by vcs.
  • Add %repo_name placeholder for URL templates at URL handler plugins.
  • Use $repo->pluginInstances data member to store instantiated object for webviewer.
  • Move VersioncontrolRepositoryUrlHandler into its own inc file.
  • Add directory_log_view URL template for URL handlers
sdboyer’s picture

I'll try to get to this a little later tonight, very focused on the beanstalkd stuff atm.

marvil07’s picture

StatusFileSize
new2.89 KB
new31.53 KB

I noticed some mistakes while implementing integration on views handlers, so here the fixes.

sdboyer’s picture

Status: Needs review » Needs work
 +      if (!class_exists($class_name)) {
 +        throw new Exception("Plugin 'webviewer_url_handler' of type 'webviewer_url_handlers' does not contain a valid class name in handler slot 'handler'", E_WARNING);
 +        return FALSE;
 +      }

There's static text that should be variable in those error messages.

 +    unset($data['versioncontrol']['url_handler']);
 +    $data['versioncontrol']['base_url'] = '';
 +    $data = serialize($row->data);

I don't like the namespacing within the $data array, never did (sign of bad architecture, IMO). Let's not introduce any more of it.

The gitweb inc is still in there, and...

 @@ -149,9 +149,14 @@ abstract class VersioncontrolTestCase extends DrupalWebTestCase {
        'auth_handler' => 'ffa',
        'author_mapper' => 'simple_mail',
        'committer_mapper' => 'simple_mail',
 +      //FIXME use a general commitlog url handler
 +      'webviewer_url_handler' => 'gitweb',
      );

...still referenced in the views handler.

I must admit, I'd never quite thought to do what you've done with the 'none' plugin for this - use variables statically declared as part of the plugin as args to the plugin's class. Kinda awkward, but OK for us to start with, anyway.

Apart from that stuff, looking pretty good. Fix it up and I think we're RTBC, though we'll need a follow-up issue to do the gitweb plugin in vc_git.

marvil07’s picture

Status: Needs work » Needs review
StatusFileSize
new3.78 KB
new31.63 KB

Ok, here the changes mentioned on #15.

sdboyer’s picture

Status: Needs review » Fixed

OK great. Go ahead and commit.

sdboyer’s picture

Status: Fixed » Reviewed & tested by the community
marvil07’s picture

StatusFileSize
new30.9 KB
new6.96 KB

I changed some things before committing:

marvil07’s picture

Status: Reviewed & tested by the community » Fixed

Ok, it's in!

Status: Fixed » Closed (fixed)
Issue tags: -git phase 2, -git sprint 8

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 82af631 on repository-families, drush-vc-sync-unlock by marvil07:
    feature #354509 by marvil07 | sdboyer: Make repository URL backends...

  • Commit 82af631 on repository-families by marvil07:
    feature #354509 by marvil07 | sdboyer: Make repository URL backends...