Refactoring common parts of xcvs-config.php, xsvn-config.php, etc.

haxney's picture

While perusing the xcvs code, I noticed that xcvs-config.php had a fair amount of code which was very non-cvs-specific, like xcvs_bootstrap and xcvs_get_temp_directory. These functions will be mostly or entirely identical for all backend hooks, so why not move them somewhere common, like in the versioncontrol module.

It might make loading a bit more complicated, and it really isn't that much code (and seems fairly unlikely to change, so there won't be a big problem of keeping a lot of copied code in sync), so it probably isn't worth it if there is too much involved.

Comments

Payoff

jpetso's picture

The last sentence in your post was exactly my reasoning as well. Bootstrap obviously can't be outsourced to versioncontrol.module because we're not in a Drupal environment yet (surprise!), and the rest of the shared code is so minimal that pushing it upstream causes more confusion than consolidation. I'd say let's duplicate those few lines of code, and keep the functions inside the actual scripts.

Bootstrapping

haxney's picture

Ah, right, the bootstrapping issue. I had forgotten about the minor fact that the Drupal environment isn't set up at the time we are loading the config files :). In that case, it's probably not worth the trouble, even to avoid having multiple copies of a (mostly) identical file in each of the backends.

Aside from that, most of the other code (at least for the SVN pre-commit hook) seems to be different enough that trying to pull out a common core would only lead to headaches.

Oh well :)

Revision Control Systems

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week