[Cvsshell-devel] CVS: cvsshell/src basic_cmds.py,1.28,1.29 cvs_cmds.py,1.22,1.23 cvs_shell.py,1.44,1
Status: Beta
Brought to you by:
stefanheimann
|
From: Stefan H. <ste...@us...> - 2003-04-21 08:02:31
|
Update of /cvsroot/cvsshell/cvsshell/src
In directory sc8-pr-cvs1:/tmp/cvs-serv1295/src
Modified Files:
basic_cmds.py cvs_cmds.py cvs_shell.py
Log Message:
* improved diff command
* improved documentation
Index: basic_cmds.py
===================================================================
RCS file: /cvsroot/cvsshell/cvsshell/src/basic_cmds.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** basic_cmds.py 20 Apr 2003 21:35:26 -0000 1.28
--- basic_cmds.py 21 Apr 2003 08:02:24 -0000 1.29
***************
*** 28,31 ****
--- 28,63 ----
#####################################
+ _helpShell = """
+
+ All non-cvsshell commands are passed to the underlying shell. If you
+ want to use a cvsshell command as a shell command, you must prefix it
+ with a `!'/
+
+ You can use IDs from the current listing as arguments to shell
+ commands. If the IDs are the only arguments to the command you can
+ use them directly. If the IDs should be embedded into other command
+ options, you should enclose them with `[[' and `]]'.
+
+ Examples:
+
+ rm -f [[1,2]]
+ remove the files with ID 1 and 2
+
+ vim 12
+ edit the file with ID 12 using vim
+
+ More information on the format of the ID-string is available by typing
+ `help list'.
+
+ To use the result of a shell command as an argument to a cvsshell
+ command you have to quote the shell command using the backquote
+ character.
+
+ Example:
+
+ commit `find . -name '*.py'`
+ commits all .py files
+ """
+
def cmdHelp(app, name, opts):
"""Print this help message.
***************
*** 38,42 ****
try:
cmd = so[0]
! doc = app.cmdToDoc[cmd]
help = doc.strip() + '\n'
app.more(help)
--- 70,77 ----
try:
cmd = so[0]
! if cmd == 'shell':
! doc = _helpShell
! else:
! doc = app.cmdToDoc[cmd]
help = doc.strip() + '\n'
app.more(help)
***************
*** 61,78 ****
help += "%s%s %s\n" % (name,space,doc)
help += """
! All commands not listed here are passed to the underlying shell. You
! can also use IDs from the current listing as arguments to these
! commands. If the IDs should be embedded into other command options,
! you can enclose them with `[[' and `]]'.
!
! Example:
! rm -f [[1,2]]
! removes the files with ID 1 and 2
!
! More information on the format of the ID-string is available by typing
`help list'.
! You can get more help for a specific command by typing `help
! <name-of-command>'.
"""
app.more(help)
--- 96,108 ----
help += "%s%s %s\n" % (name,space,doc)
help += """
! Many commands accepts IDs from the current listing as arguments. More
! information on the format of the ID-string is available by typing
`help list'.
! All commands not listed here are passed to the underlying shell. Type
! `help shell' to get more help on invoking shell commands.
!
! You can get more help for a specific command by typing
! `help <name-of-command>'.
"""
app.more(help)
Index: cvs_cmds.py
===================================================================
RCS file: /cvsroot/cvsshell/cvsshell/src/cvs_cmds.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** cvs_cmds.py 20 Apr 2003 21:35:27 -0000 1.22
--- cvs_cmds.py 21 Apr 2003 08:02:26 -0000 1.23
***************
*** 38,42 ****
If you want to display the status only for certain files, you can
specify these files as arguments to the `status' command (either via
! filenames of ids in the listing).
"""
import stat
--- 38,42 ----
If you want to display the status only for certain files, you can
specify these files as arguments to the `status' command (either via
! filenames of IDs in the listing).
"""
import stat
***************
*** 60,63 ****
--- 60,66 ----
# args do not spefiy ids in the current listing
except utils.ParseError: pass
+ except AppError, msg:
+ app.printErr(msg)
+ return
try:
lines = app.runCvsCmd('status', globOpts=globOpts, args=opts+' '+rest, getStderr=1)
***************
*** 117,122 ****
If you want to update only some files, you can specify these files as
! arguments to the `update' command (either via filenames of ids in the
! listing).
For every file a letter denoting its status is displayed (the
--- 120,127 ----
If you want to update only some files, you can specify these files as
! arguments to the `update' command (either via filenames or an
! ID-string). More information on the format of the ID-string is
! available by typing `help list'.
!
For every file a letter denoting its status is displayed (the
***************
*** 498,502 ****
You must specify the file to rename (the `source file') and the new
name of the file (the `target file'). The source file can be a
! filename or an id in the listing. The filename of the target file may
include the special variable $OLD_DIR. This variable is replaced by
the directory the source file resides in.
--- 503,507 ----
You must specify the file to rename (the `source file') and the new
name of the file (the `target file'). The source file can be a
! filename or an ID in the listing. The filename of the target file may
include the special variable $OLD_DIR. This variable is replaced by
the directory the source file resides in.
***************
*** 597,601 ****
Example:
! 3, 4, 7-10, !8, 12-19, !13-18
selects the files with the ids 3, 4, 7, 9, 10, 12, 19
--- 602,607 ----
Example:
!
! 3, 4, 7-10, !8, 12-19, !13-18
selects the files with the ids 3, 4, 7, 9, 10, 12, 19
***************
*** 669,673 ****
* the revision to replace the file with
! * the file to replace
"""
try:
--- 675,679 ----
* the revision to replace the file with
! * the file to replace (a filename or an ID in the listing)
"""
try:
***************
*** 750,766 ****
"""Prints a diff of two revisions of a file.
! There are 4 ways of invoking the diff command:
! (1) diff <filename or id>
Prints a diff between the latest repository revion and the local version.
! (2) diff <revision> <filename or id>
Prints a diff between the given repository revision and the local version.
! (3) diff <revision 1> <revsion 2> <filename or id>
Prints a diff between the two given repository revisions.
!
! (4) diff
! Prompts you for all arguments needed.
"""
try:
--- 756,783 ----
"""Prints a diff of two revisions of a file.
! There are 3 ways of invoking the diff command:
! (1) diff <filenames or ID-string>
Prints a diff between the latest repository revion and the local version.
! (2) diff <revision> <filenames or ID-string>
Prints a diff between the given repository revision and the local version.
! (3) diff <revision> <revsion> <filenames or ID-string>
Prints a diff between the two given repository revisions.
!
! `<revion>' is a revision number or a date. In the latter case, the
! most recent revision no later than date is used. If `<revision>' is a
! revision number you must prepend the `-r' commandline option to the
! revision number, if it's a date you must use the `-D' option.
!
! More information on the format of the ID-string is available by typing
! `help list'.
!
! Example:
!
! diff -r 1.2 -D 2002-05-25 0
! Prints a diff of the file with ID 0 between revision 1.2 and the most
! recent revision no later than 2002-05-25.
"""
try:
***************
*** 771,816 ****
app.printErr(msg)
return
! rest = rest.split()
! rev1 = ''
! rev2 = ''
! fileOrId = ''
! n = len(rest)
! if n == 0:
! rev1 = app.prompt('Revision 1 of the file (leave blank if you want to compare the '\
! 'working\ndirectory version with the latest revision in the repository): ')
! if rev1 is None: return
! elif rev1 != '':
! rev2 = app.prompt('Revision 2 of the file (leave blank if you want to compare the '\
! 'working\ndirectory version with revision 1): ')
! if rev2 is None: return
! if rev1: rev1 = '-r ' + rev1
! if rev2: rev2 = ' -r ' + rev2
! fileOrId = app.prompt('Filename(s) or ID(s): ')
! if fileOrId is None: return
! elif n == 1:
! fileOrId = rest[0]
! elif n == 2:
! if os.path.exists(rest[0]):
! fileOrId = rest[0] + ' ' + rest[1]
! else:
! rev1 = '-r ' + rest[0]
! fileOrId = rest[1]
! else:
! if os.path.exists(rest[0]):
! fileOrId = ' '.join(rest)
! elif os.path.exists(rest[1]):
! rev1 = '-r ' + rest[0]
! fileOrId = ' '.join(rest[1:])
! else:
! rev1 = '-r ' + rest[0]
! rev2 = ' -r ' + rest[1]
! fileOrId = ' '.join(rest[2:])
try:
! filenames = ' '.join(app.applyOnEntryList(fileOrId, lambda e, fname: fname))
except utils.ParseError: # args do not spefiy ids in the current listing
! filenames = fileOrId
! args = opts + ' ' + rev1 + rev2 + ' ' + filenames
try:
app.more(app.runCvsCmd('diff', globOpts=globOpts, args=args))
except CvsError:
return
--- 788,803 ----
app.printErr(msg)
return
! print opts, rest
try:
! filenames = ' '.join(app.applyOnEntryList(rest, lambda e, fname: fname))
except utils.ParseError: # args do not spefiy ids in the current listing
! filenames = rest
! except AppError, msg:
! app.printErr(msg)
! return
! args = opts + ' ' + filenames
try:
app.more(app.runCvsCmd('diff', globOpts=globOpts, args=args))
except CvsError:
return
+
Index: cvs_shell.py
===================================================================
RCS file: /cvsroot/cvsshell/cvsshell/src/cvs_shell.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** cvs_shell.py 20 Apr 2003 21:35:27 -0000 1.44
--- cvs_shell.py 21 Apr 2003 08:02:26 -0000 1.45
***************
*** 318,322 ****
# on windows, cvs seems to output all information on stdout
if getStderr and not self.onWindows: cmd += ' 2>&1'
! self.printVMsg(cmd)
if fork:
f = os.popen(cmd)
--- 318,322 ----
# on windows, cvs seems to output all information on stdout
if getStderr and not self.onWindows: cmd += ' 2>&1'
! if self.isVerbose(): self.printVMsg(' '.join(cmd.split()))
if fork:
f = os.popen(cmd)
|