Closed
Bug 402461
Opened 19 years ago
Closed 19 years ago
Make SVN post-commit script to notify kublad of updated files in SVN
Categories
(Webtools Graveyard :: Kubla, defect)
Webtools Graveyard
Kubla
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: wenzel, Assigned: wenzel)
Details
Attachments
(1 file, 3 obsolete files)
|
6.08 KB,
patch
|
clouserw
:
review+
|
Details | Diff | Splinter Review |
An SVN post-commit script should POST the files changed in a recent commit to the kublad daemon so that it can update its working copy accordingly.
Comment 1•19 years ago
|
||
Woah. There's a kublad daemon? When did this happen? I guess I've been out of the loop too much with regards to Kubla. :(
| Assignee | ||
Comment 2•19 years ago
|
||
Hey Wil, here is a script that should be doing what you wanted. Can you try hooking it up to a running instance of kublad? (I am currently having trouble getting it to work because the MySQLdb library package is broken for MacPorts at the moment so I couldn't install it).
I am pretty positive that it does it right (it fetched changes from my local test repository without problems) and I also checked that svn update on a deleted file works.
Let me know if this is what you intended or if I need to make changes.
Attachment #287322 -
Flags: review?(clouserw)
| Assignee | ||
Comment 3•19 years ago
|
||
(In reply to comment #1)
> Woah. There's a kublad daemon? When did this happen? I guess I've been out of
> the loop too much with regards to Kubla. :(
Ah, Wil knows. I assume it hasn't been around for long and its basic idea is updating only changed parts of the SVN tree when changes are committed, because svn up on big working copies is pretty slow.
Comment 4•19 years ago
|
||
Comment on attachment 287322 [details] [diff] [review]
Kubla SVN post-commit hook, first take
When I run your script after a commit I get:
> Warning: 'post-commit' hook failed with error output:
> Traceback (most recent call last):
> File "/home/clouserw/temp/svn/hooks/post-commit", line 77, in ?
> changes = getChangedFiles(sys.argv[1], sys.argv[2])
> File "/home/clouserw/temp/svn/hooks/post-commit", line 34, in getChangedFiles
> revision2=revision
> pysvn._pysvn_2_4.ClientError: '/home/clouserw/temp/svn' is not a working copy
/home/clouserw/temp/svn is the actual repository itself - nothing to do with the checked out copy.
Attachment #287322 -
Flags: review?(clouserw) → review-
| Assignee | ||
Comment 5•19 years ago
|
||
Ah, thanks! -- looks like I need to prepend file:// in order to make it realize that we are talking about repositories here. Will do!
| Assignee | ||
Comment 6•19 years ago
|
||
This should get you further now. Sorry bout that.
Attachment #287322 -
Attachment is obsolete: true
Attachment #287382 -
Flags: review?(clouserw)
Comment 7•19 years ago
|
||
The new script is looking good - I don't see any logic about when to send the POST data. Does it send a request for all commits to the repository? If so, we should add a config var for what paths to match and strip. For example, the config var would be:
SVNPath=/projects/mozilla.com/trunk
And then the hook script would first make sure that path is at the beginning of whatever they committed (that would keep us from sending commits to our script that have nothing to do with moz.com) and then the script would strip out SVNPath from the beginning of the path before sending it. That way the paths are relative to whatever the config var is.
Does that make sense?
Comment 8•19 years ago
|
||
Also, I'm not sure how easy it would be, but it would be awesome if we could make the host and port an array, so one hook script could talk to multiple daemons. This way we wouldn't need to run multiple hooks to update staging and prod.
| Assignee | ||
Comment 9•19 years ago
|
||
Ah, indeed, I did not think about stripping out a base path. Will add this.
Also, I assume adding multiple servers is probably easily possible (will look at that configparser module again), but then I probably need to do some more elaborate error handling than just raising (or dropping) the error, right?
Comment 10•19 years ago
|
||
(In reply to comment #9)
> Ah, indeed, I did not think about stripping out a base path. Will add this.
>
> Also, I assume adding multiple servers is probably easily possible (will look
> at that configparser module again), but then I probably need to do some more
> elaborate error handling than just raising (or dropping) the error, right?
>
Just printing something on stderr would be fine with me. I'm adding oremj to see if he has any other opinions on a better way to get IT's attention.
Updated•19 years ago
|
Attachment #287382 -
Flags: review?(clouserw) → review-
| Assignee | ||
Comment 11•19 years ago
|
||
Okay, this script can now handle prefixes as you described, and you can also define multiple kublad servers.
As a prefix, you want to define:
projects/mozilla.com/(trunk|prod)/
(no leading /, but trailing; parentheses around the "target" you want to handle in kublad).
As for error handling, for now I just print the exception to stderr if I can't access one of the servers. With no errors, the script should be silent.
Attachment #287382 -
Attachment is obsolete: true
Attachment #287586 -
Flags: review?(clouserw)
| Assignee | ||
Comment 12•19 years ago
|
||
Okay, this is better: You can now use entirely different prefixes for your different branches by adding a new line to the prefixes section (more flexible and also more intuitive than the regex). There, you want to put two lines similar to:
prod=projects/mozilla.com/tags/production/
trunk=projects/mozilla.com/trunk/
The part before the = will become part of the kublad URL, the part behind the = is the actual prefix and will be cut off.
Changed files that don't match either of the defined prefixes will be ignored and not pinged to any kublad server.
Attachment #287586 -
Attachment is obsolete: true
Attachment #287666 -
Flags: review?(clouserw)
Attachment #287586 -
Flags: review?(clouserw)
Comment 13•19 years ago
|
||
Script is in SVN with a couple minor tweaks here ( http://svn.mozilla.org/projects/kubla/trunk/scripts/svn_hooks/ ).
Thanks wenzel.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Updated•19 years ago
|
Attachment #287666 -
Flags: review?(clouserw) → review+
Updated•10 years ago
|
Product: Webtools → Webtools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•