python script for tortoise cvs

S

sandeep

hi

we are using tortoise cvs and putty. i want to write a python script
to whom i can provide a tag and module.now what this script will do is
look for this specific tag and checks for whether its a individual tag
or its inside a branch.if its inside a branch then find out what is
the branch tag and then check out that branch for me else it checks
out that module with that tag.

Actually the thing is i am not able to find the way how i will do it
and for where i have to look for the info.so any help will be
appreciated.

thanks and regards
sandeep kumar sharma
 
S

Simon Brunning

hi

we are using tortoise cvs and putty. i want to write a python script
to whom i can provide a tag and module.now what this script will do is
look for this specific tag and checks for whether its a individual tag
or its inside a branch.if its inside a branch then find out what is
the branch tag and then check out that branch for me else it checks
out that module with that tag.

Actually the thing is i am not able to find the way how i will do it
and for where i have to look for the info.so any help will be
appreciated.

I don't know if Tortoise is scriptable, but Subversion certainly is -
<http://pysvn.tigris.org/> - and nothing you mention is Tortoise
specific.

--
Cheers,
Simon B.
(e-mail address removed)
http://www.brunningonline.net/simon/blog/
GTalk: simon.brunning | MSN: small_values | Yahoo: smallvalues | Twitter: brunns
 
G

Gabriel Genellina

I don't know if Tortoise is scriptable, but Subversion certainly is -
<http://pysvn.tigris.org/> - and nothing you mention is Tortoise
specific.

(Note that he said Tortoise CVS - not Tortoise SVN)
To Sandeep: You should divide the question in two parts:
- how to obtain the info you want from cvs. This has nothing to do with Python; better ask in a CVS group related to your server. Suppose the answer is "use the status command with the -lv options", then you'll be able to obtain the info you want "by hand", executing said cvs command from the cmd prompt.
- the next task is to automate the execution using Python. You have to run the command, capture its output and extract the info you want. How to do that *is* a Python question, but you'll have to formulate it very precisely: "I want to read the output coming from this command, locate the line that contains the word XXX starting at column 12, and take the last word on the third line below it"
For that second part you can get some help here, but first you have to know *what* to execute and *what* to look for in the output.

(Anyway, I think the question is not well formulated - what is an "individual tag", as opposed to "inside a branch"? Every tag applied on a file marks a certain revision in a certain branch, - if you consider the trunk as a branch too. Do you want to know if the tag was applied directly over a file on the trunk? Or do you want to know if the tag is a "branch tag"?)
 
S

sandeep

En Thu, 19 Jun 2008 10:26:09 -0300, Simon Brunning <[email protected]> escribió:





(Note that he said Tortoise CVS - not Tortoise SVN)
To Sandeep: You should divide the question in two parts:
- how to obtain the info you want from cvs. This has nothing to do with Python; better ask in a CVS group related to your server. Suppose the answer is "use the status command with the -lv options", then you'll be able to obtain the info you want "by hand", executing said cvs command from the cmd prompt.
- the next task is to automate the execution using Python. You have to run the command, capture its output and extract the info you want. How to do that *is* a Python question, but you'll have to formulate it very precisely: "I want to read the output coming from this command, locate the line that contains the word XXX starting at column 12, and take the last word on the third line below it"
For that second part you can get some help here, but first you have to know *what* to execute and *what* to look for in the output.

(Anyway, I think the question is not well formulated - what is an "individual tag", as opposed to "inside a branch"? Every tag applied on a file marks a certain revision in a certain branch, - if you consider the trunk as a branch too. Do you want to know if the tag was applied directly over a file on the trunk? Or do you want to know if the tag is a "branch tag"?)


thanks Gabriel

i think ur suggestions do formulate my problem.now since i know some
commands i wanted to know how can i execute cvs commands from python
or we can say how can i capture the output from the cvs command ?.

thanks and regards
sandeep kumar sharma
 
G

Gabriel Genellina

i think ur suggestions do formulate my problem.now since i know some
commands i wanted to know how can i execute cvs commands from python
or we can say how can i capture the output from the cvs command ?.

Use the subprocess module
<http://docs.python.org/lib/module-subprocess.html>

py> cvsexe = r"c:\Archivos de programa\CVSNT\cvs.exe"
py> import subprocess
py> p = subprocess.Popen([cvsexe, "status", "dinglob.pas"],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
py> output = p.communicate()[0]
py> print output
===================================================================
File: dinglob.pas Status: Up-to-date

Working revision: 1.102
Repository revision: 1.102 /.../DINW/dinglob.pas,v
Expansion option: kv
Commit Identifier: 484474257304f18
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
Merge From: (none)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top