Modify

Opened 13 years ago

Closed 13 years ago

#8341 closed defect (fixed)

SVN post commit hook MERGE message reported

Reported by: Anders Hedberg Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

When using the latest 0.12 version of the trac-post-commit-hook I got a strange MERGE message back on checkin to subversion. My local copy of the checked in file did not advance the version number, but the subversion repository got the new file-version. The ticket was not updated either.

An older version (I saved previously for 0.11) of the hook script works ok so I assume that it is only the trac-...-hook script that is malfunctioning. I could not find any helpful things in the logs for apache,trac or the hook script itself.

I'm using Eclipse 3.5.2 with Subclipse (which put up the dialogbox with the MERGE message) Subversion on server is version 1.6.12. Trac is 0.12.

Attachments (2)

2010-12-28 21-42-41 Merge error.png (36.0 KB) - added by Anders Hedberg 13 years ago.
Merge error
2010-12-28_21-42-41_Merge_error.gif (17.1 KB) - added by Anders Hedberg 13 years ago.
New try with a gif file and no space…

Download all attachments as: .zip

Change History (10)

comment:1 Changed 13 years ago by Russ Tyndall

Well you haven't given me much to work with here. I have tested that script, but it is modified from my default (which interacts with more/other systems), so their could be bugs. If you message didnt get through that sound like a bug.

Did you get the log for the commit hook or if you did, what was in it? (It looks like by default I have logging setup oddly). But if you are not getting a log make sure that the logfile and LOG variables make sense, and that the script has permission to write to that location. After you get logging of some sort working, please post it here and I will see if we cant get it working.

HTH, Russ

comment:2 Changed 13 years ago by Anders Hedberg

This is the log-message of the commit hook on the Trac side. Enjoy ;-)

Begin Log cmd_groups:[(u'references', u'#273 (1)', u'1', u)] cmd:references, tkts#273 (1) tkt_id:273, vals[[<bound method CommitHook?._cmdRefs of <main.CommitHook? inst ance at 0x9c7a74c>>, u'1']] Setting ticket:<trac.ticket.model.Ticket object at 0xa1c1d8c> spent: 1.0

comment:3 in reply to:  2 Changed 13 years ago by Anders Hedberg

Replying to AndersH:

This is the log-message of the commit hook on the Trac side. Enjoy ;-)

Begin Log cmd_groups:[(u'references', u'#273 (1)', u'1', u)] cmd:references, tkts#273 (1) tkt_id:273, vals[[<bound method CommitHook?._cmdRefs of <main.CommitHook? inst ance at 0x9c7a74c>>, u'1']] Setting ticket:<trac.ticket.model.Ticket object at 0xa1c1d8c> spent: 1.0

I forgot to add that it looks exactly like the logmessage of the old working script when testing. (besides the 0x-numbers)

comment:4 Changed 13 years ago by Russ Tyndall

hrm... well, that looks like it should work (especially if it was matches the old one line for line).

Can I get a copy or screen shot of the weird MERGE message? Also just to make sure I understand:

  • The commit to the repository was successful
  • Your working copy did not correctly update to the latest new revision
  • What is your svn status after the half commit?
  • What happens when you svn update?
  • I assume this is perfectly repeatable on your end ? (ie: every commit behaves the same)

I am trying to duplicate this on my end at the moment (on a fresh svn repo)

Changed 13 years ago by Anders Hedberg

Merge error

Changed 13 years ago by Anders Hedberg

New try with a gif file and no space...

comment:5 in reply to:  4 Changed 13 years ago by Anders Hedberg

Replying to bobbysmith007:

Can I get a copy or screen shot of the weird MERGE message? Also just to make sure I understand:

  • The commit to the repository was successful

Yes.

  • Your working copy did not correctly update to the latest new revision

Yes.

  • What is your svn status after the half commit?

Don't know, not using command line subversion.

  • What happens when you svn update?

From the console window in Eclipse (first is commit, then separate update):

commit -m "References #273 (0.5)..." C:/Users/Anders/workspace/Swegon/dummy_test.txt
    Sending        Users/Anders/workspace/Swegon/dummy_test.txt
    Transmitting file data ...
    RA layer request failed
svn: Commit failed (details follow):
svn: MERGE of '/svn/trunk': 200 OK (https://gw.join.ideon.se:447)

update C:/Users/Anders/workspace/Swegon/dummy_test.txt -r HEAD --force
    G  C:/Users/Anders/workspace/Swegon/dummy_test.txt
    Updated to revision 493.
    ===== File Statistics: =====
    Merged: 1
  • I assume this is perfectly repeatable on your end ? (ie: every commit behaves the same)

Yes, at least two times. Going into the repository view and then manually overwriting the file from the repository makes the local copy ok.

I am trying to duplicate this on my end at the moment (on a fresh svn repo)

comment:6 Changed 13 years ago by Russ Tyndall

I added some better error logging to the scripts (so you might wish to update like the last 10 lines of your file to match this revision).

You should try running the post commit script manually as below and post any errors you get.

From the trac-post-commit directory try executing:

./trac-post-commit.py -u 'youruser' -p '/var/trac/yourTracUrl' -r 493

I was able to execute mine and get no obvious errors, do you get any?

Thanks, Russ

comment:7 Changed 13 years ago by Russ Tyndall

This is the svn post-commit I am using, it might give you better logging?

#!/bin/bash
log() {
    while read data
    do
    echo "[$(date +'%T')] $data" | tee -a $LOG || continue
    done
}

set -e
REPOS="$1"
REV="$2"
CNAME=`basename "$REPOS"`
export LOGDIR="/var/log/commit-hooks"
LOG="${LOGDIR}/$CNAME.svn-post-commit.log"
mkdir -p "${LOGDIR}"

echo "`date +'%F'` in svn post commit : $REPOS : $REV" | log
MESSAGE=`svnlook log -r $REV $REPOS`
AUTHOR=`svnlook author -r $REV $REPOS`

if [ -z "$TRAC_ENV" ] && [ -e "/var/trac/$CNAME" ]; then
    export TRAC_ENV="/var/trac/$CNAME"
fi

echo "TracEnv:$TRAC_ENV Repo:$REPOS Rev:$REV Auth:$AUTHOR" | log

/usr/bin/python /path/to/your/trac-post-commit.py -p "$TRAC_ENV" -r "$REV" -u "$AUTHOR" -m "$MESSAGE" 2>&1 | log
echo "Done with trac: $?" | log

comment:8 Changed 13 years ago by anonymous

Resolution: fixed
Status: newclosed

Sorry to bother you with the above. I had an urgent delivery problem and was not able to check more into this at that time, needed to get things out the door to the customer.

I found the error. I had executed the logging post-commit scripts as root on my debian machine for testing, and thus created a log-file owned by root not writeable by the www-data user. When checking in code to svn/apache the scripts was executed as www-data, and there was a "Permission denied" when opening the log/commithook.log file and the trac-post-commit-hook crashed with an IOError exception. (just as it should, just hard to debug this particular error ;-) Thanks for the help with the scripts anyway! /Anders H.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.