[prev in list] [next in list] [prev in thread] [next in thread] 

List:       relax-devel
Subject:    improved svnmerge
From:       "Gary S. Thompson" <garyt () domain ! hid>
Date:       2007-04-24 9:25:48
Message-ID: 462DCD1C.2040101 () domain ! hid
[Download RAW message or body]

dear All
I have just tried to use svnmerge for the firdst time today and found it 
fairly hellish because it asks for you passphrase over and over again. 
However, I found this nice hack using expec

#!/usr/bin/expect --
#
# Wrap the svnmerge script, so we're only prompted for our password once.
#
# Written by Tilghman Lesher <repotools-mergetool@domain.hid>
#

eval [ concat spawn /usr/bin/svnmerge.real [ lrange $argv 0 end ] ]

expect {
	"Passphrase for" {
		puts "ghere"
		stty -echo
		expect_user -re "(.*)\n"
		stty echo
		send "$expect_out(1,string)\r"
	}
}

expect_after eof exit
while (1) {
	expect {
		"Passphrase for" {
			send "$expect_out(1,string)\r"
		}
	}

}

which I modified as follows

#!/usr/bin/expect --
#
# Wrap the svnmerge script, so we're only prompted for our password once.
#
# Written by Tilghman Lesher <repotools-mergetool@domain.hid>
#
set home $env(HOME)
set svn_merge_path [file join $home bin/svnmerge.py]
eval [ concat spawn  $svn_merge_path  [ lrange $argv 0 end ] ]

expect {
        "*assphrase for" {
                stty -echo
                expect_user -re "(.*)\n"
                stty echo
                send "$expect_out(1,string)\r"
        }
}

expect_after eof exit
while (1) {
        expect
        expect {
                "*assphrase for" {
                        send "$expect_out(1,string)\r"
                }
        }
}

so
1. it now expects the real svnmerge.py to be in $HOME/bin
2. it had a capital P for passphrase which doesn't match all svn versions
3. I haven't managed to suppress all the extra printings of Enter 
passphrase for key ... yest but should be able to
4, it will crash if it doesn't see a Enter passphrase at all:
expect: spawn id exp4 not open
    while executing
"expect_after eof exit"
    (file "/usr/jessy/garyt/bin/svnmerge" line 20)
/

regards
gary

-- 
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK             Tel. +44-113-3433024
email: garyt@domain.hid                   Fax  +44-113-2331407
-------------------------------------------------------------------




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic