[opensuse] howto - better quick and dirty way to get svn rev of local copy?
Guys, I want a quick and dirty want to get the svn revision of a local svn module. What I'm currently doing is: #!/bin/bash getsvnrev() { msg "Determining SVN revision for $pkgname..." [[ -d .svn ]] && echo $(sed -n '4p' .svn/entries) || echo 9999 } pkgver=$(getsvnrev) It works fine, but is there a standard way (no not svnversion) to read the local version other than the backwards way I'm doing it? -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2011-02-15 at 17:28 -0600, David C. Rankin wrote:
Guys,
I want a quick and dirty want to get the svn revision of a local svn module. What I'm currently doing is:
#!/bin/bash getsvnrev() { msg "Determining SVN revision for $pkgname..." [[ -d .svn ]] && echo $(sed -n '4p' .svn/entries) || echo 9999 }
pkgver=$(getsvnrev)
It works fine, but is there a standard way (no not svnversion) to read the local version other than the backwards way I'm doing it?
-- David C. Rankin, J.D.,P.E.
I have been using this: svn info | grep "Last Changed Rev:" | cut -d' ' -f 4 Works for me. But I never have liked the grep of a string as I guess it could change based on a locale setting. Nonetheless, it works for me. Yours sincerely, Roger Oberholtzer OPQ Systems / Ramböll RST Office: Int +46 10-615 60 20 Mobile: Int +46 70-815 1696 roger.oberholtzer@ramboll.se ________________________________________ Ramböll Sverige AB Krukmakargatan 21 P.O. Box 17009 SE-104 62 Stockholm, Sweden www.rambollrst.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 02/16/2011 02:34 AM, Roger Oberholtzer wrote:
On Tue, 2011-02-15 at 17:28 -0600, David C. Rankin wrote:
Guys,
I want a quick and dirty want to get the svn revision of a local svn module. What I'm currently doing is:
#!/bin/bash getsvnrev() { msg "Determining SVN revision for $pkgname..." [[ -d .svn ]] && echo $(sed -n '4p' .svn/entries) || echo 9999 }
pkgver=$(getsvnrev)
It works fine, but is there a standard way (no not svnversion) to read the local version other than the backwards way I'm doing it?
-- David C. Rankin, J.D.,P.E.
I have been using this:
svn info | grep "Last Changed Rev:" | cut -d' ' -f 4
Works for me. But I never have liked the grep of a string as I guess it could change based on a locale setting. Nonetheless, it works for me.
Yours sincerely,
Roger Oberholtzer
Thanks Roger, It looks like sed -n '4p' .svn/entries -> gives Revision: sed -n '11p' .svn/entries -> gives Last Changed Rev: Only problem is I don't know how consistent the 4/11 line numbers are. or using svn info (without pipes) Revision: cut -d' ' -f 2 < <(grep "Revision:" < <(svn info)) Last Changed Rev: cut -d' ' -f 4 < <(grep "Last Changed Rev:" < <(svn info)) I like svn info! Thanks -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2011-02-15 at 17:28 -0600, David C. Rankin wrote:
Guys,
I want a quick and dirty want to get the svn revision of a local svn module. What I'm currently doing is:
#!/bin/bash getsvnrev() { msg "Determining SVN revision for $pkgname..." [[ -d .svn ]] && echo $(sed -n '4p' .svn/entries) || echo 9999 }
pkgver=$(getsvnrev)
It works fine, but is there a standard way (no not svnversion) to read the local version other than the backwards way I'm doing it?
-- David C. Rankin, J.D.,P.E.
Forgot to add that I also use the following to determine if there are local modifications that are not checked in: svn status | cut -d' ' -f 1 | grep M | sort | uniq Yours sincerely, Roger Oberholtzer OPQ Systems / Ramböll RST Office: Int +46 10-615 60 20 Mobile: Int +46 70-815 1696 roger.oberholtzer@ramboll.se ________________________________________ Ramböll Sverige AB Krukmakargatan 21 P.O. Box 17009 SE-104 62 Stockholm, Sweden www.rambollrst.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
David C. Rankin
-
Roger Oberholtzer