Hi,
to simplify some code for versioncontrol_git related to tags I'd need a function which updates either a whole operation or just the labels assigned to it. Really cool would be a function which you pass the operation and an array of the keys you want to be replaced. Another possibility would be a function to add another label to an operation. If you don't like both, it may be a bug that a tag doesn't autoadd itself to the tagged commit which then should be fixed :P
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | versioncontrol-update-operation-labels.diff | 7.67 KB | jpetso |
Comments
Comment #1
CorniI commentedupdate: As code evolved, I need particular a fast function to replace all branches which are assigned to an $operation with an array of labels without using the database directly. This is pretty critical for the versioncontrol_git speed. More generalized, but slower, functions, are appreciated, too, for usage in less speed-critical code paths.
Comment #2
jpetso commentedBoth approaches sound useful to me, although restricting changes to labels for now might be easier to implement, given the potential changes that come with operation changes. (Note that modules are able to implement hook_versioncontrol_operation() so they might rely on some of the stuff in the operation, all of that would need to be checked and changed for an actual whole-operation update.)
An actual API for label management is badly missing in Version Control API, I would love to have a set of get_labels() and delete_label() functions. Your other issue (#426284: API request: versioncontrol_get_label_list()) is an important step into the right direction, and a function that updates operation labels would be similarly welcome. Should also provide some hook for modules that store something that uses operation label information.
Note that this is not top priority for me though at the moment (sorry), so I might not come up with such a function by myself. Anyways, how about
versioncontrol_update_operation_labels($operation, $labels)as function signature?Comment #3
CorniI commentedMy problem with versioncontrol_update_operation_labels($operation, $labels) is that for everey commit I want to update the branches for i'd have to retrieve the tags, too. I looked at VCS-API and it would need this info anyways, but I think that we want the type of a label in versioncontrol_operation_labels, too, so we can update branches without updating/deleting tags. I think I could come up with a patch for doing that.
Comment #4
CorniI commentedI'm sorry, i've not any experience with hooks, this task is left for you :P
Works well on my end :)
Comment #5
jpetso commentedCreating a workable API for the hook was a bit of a challenge - would this patch work for you?
Comment #6
CorniI commentedworks fine, thanks. Please go ahead and commit the patch :)
Comment #7
jpetso commentedk, committed as is.