[Cvsshell-devel] CVS: cvsshell/src cvs_cmds.py,1.12,1.13 cvs_shell.py,1.27,1.28
Status: Beta
Brought to you by:
stefanheimann
|
From: Stefan H. <ste...@us...> - 2002-07-27 09:05:41
|
Update of /cvsroot/cvsshell/cvsshell/src
In directory usw-pr-cvs1:/tmp/cvs-serv11318/src
Modified Files:
cvs_cmds.py cvs_shell.py
Log Message:
improved status cmd
Index: cvs_cmds.py
===================================================================
RCS file: /cvsroot/cvsshell/cvsshell/src/cvs_cmds.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** cvs_cmds.py 26 Jul 2002 18:12:07 -0000 1.12
--- cvs_cmds.py 27 Jul 2002 09:05:38 -0000 1.13
***************
*** 32,41 ****
"""Display status information on checked out files.
This command creates a listing with all checked out files and
! their status.
The listing can be filtered by setting the variable
`filter' in the CONFIG section of ~/.cvsshellrc."""
entries = []
regexHead = re.compile(r'File: (?P<name>\S+)\s+Status: (?P<status>.+)')
regexDir = re.compile(r'.*Examining (?P<dir>\S+)')
regexUnknown = re.compile(r'^\?\s+(?P<filename>\S+)')
--- 32,46 ----
"""Display status information on checked out files.
This command creates a listing with all checked out files and
! their status. The abbreviation `rr' stands for `repository revision',
! `wr' means working revision.
The listing can be filtered by setting the variable
`filter' in the CONFIG section of ~/.cvsshellrc."""
+ import stat
+ from time import gmtime,strftime
entries = []
regexHead = re.compile(r'File: (?P<name>\S+)\s+Status: (?P<status>.+)')
+ regexWorkingRev = re.compile(r'\s*Working revision:\s+(\S+)')
+ regexRepRev = re.compile(r'\s*Repository revision:\s+(\S+)')
regexDir = re.compile(r'.*Examining (?P<dir>\S+)')
regexUnknown = re.compile(r'^\?\s+(?P<filename>\S+)')
***************
*** 54,58 ****
entries = []
dir = None
! for line in lines:
unknownRes = regexUnknown.search(line)
if unknownRes:
--- 59,67 ----
entries = []
dir = None
! n = len(lines)
! i = 0
! while i < n:
! line = lines[i]
! i = i+1
unknownRes = regexUnknown.search(line)
if unknownRes:
***************
*** 68,72 ****
name = headRes.group('name')
status = headRes.group('status').strip()
! entries.append(Entry(dir, name, status))
continue
dirRes = regexDir.search(line)
--- 77,90 ----
name = headRes.group('name')
status = headRes.group('status').strip()
! i = i+1 # skip empty line
! workingRev = regexWorkingRev.search(lines[i]).group(1)
! i = i+1
! repRev = regexRepRev.search(lines[i]).group(1)
! i = i+1
! try:
! time = strftime('%Y-%m-%d %H:%M', gmtime(os.stat(os.path.join(os.getcwd(), dir, name))[stat.ST_MTIME]))
! except OSError: time = ''
! info = 'rr: ' + repRev + ', wr: ' + workingRev + ', ' + time
! entries.append(Entry(dir, name, status, info))
continue
dirRes = regexDir.search(line)
Index: cvs_shell.py
===================================================================
RCS file: /cvsroot/cvsshell/cvsshell/src/cvs_shell.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** cvs_shell.py 19 Jul 2002 11:36:03 -0000 1.27
--- cvs_shell.py 27 Jul 2002 09:05:38 -0000 1.28
***************
*** 28,32 ****
from plugable_app import PlugableApp
! VERSION = '0.2.2'
NAME ='CvsShell'
COPYRIGHT = 'Copyright 2002 Stefan Heimann (ma...@st...).\n' \
--- 28,32 ----
from plugable_app import PlugableApp
! VERSION = '0.3'
NAME ='CvsShell'
COPYRIGHT = 'Copyright 2002 Stefan Heimann (ma...@st...).\n' \
***************
*** 315,319 ****
! def printListing(self):
if not self.listing:
self.printErr(self.noListingErrMsg)
--- 315,319 ----
! def printListing(self, footer=None):
if not self.listing:
self.printErr(self.noListingErrMsg)
***************
*** 325,329 ****
self.dirtyListing = 0
else:
! self.listing.printEntries()
if self.getDirtyListing():
self.printMsg("Listing may be out-of-date. " \
--- 325,329 ----
self.dirtyListing = 0
else:
! self.listing.printEntries(footer=footer)
if self.getDirtyListing():
self.printMsg("Listing may be out-of-date. " \
***************
*** 417,429 ****
self.entries.sort(__EntrySorter(self.sortOrder).cmp)
! def printEntries(self, verbose=1):
if not self.entries:
if verbose: self.app.printMsg('No entries available.')
return
! max = 0
for e in self.entries:
! l = len(e.status)
! if l > max: max = l
! formatStr = " %%%dd %%-%ds %%s%%s\n" % (len(`len(self.entries)`), max)
oldDir = None
id = 0
--- 417,430 ----
self.entries.sort(__EntrySorter(self.sortOrder).cmp)
! def printEntries(self, verbose=1, footer=None):
if not self.entries:
if verbose: self.app.printMsg('No entries available.')
return
! maxStatus = 0
! maxName = 0
for e in self.entries:
! maxStatus = max(len(e.status), maxStatus)
! maxName = max(len(e.name), maxName)
! formatStr = " %%%dd %%-%ds %%s%%s" % (len(`len(self.entries)`), maxStatus)
oldDir = None
id = 0
***************
*** 435,439 ****
lines.append("%s:\n" % newDir)
if os.path.isdir(os.path.join(self.rootDir, e.dir, e.name)):
! isDir = "<dir> "
else:
isDir = ''
--- 436,440 ----
lines.append("%s:\n" % newDir)
if os.path.isdir(os.path.join(self.rootDir, e.dir, e.name)):
! isDir = '<dir> '
else:
isDir = ''
***************
*** 441,447 ****
--- 442,451 ----
color = self.app.getConfigMap().get(colorKey, '')
s = self.app.col(color, formatStr % (id, e.status, isDir, e.name))
+ s = s + (maxName - len(e.name))*' ' + ' ' + e.info + '\n'
lines.append(s)
id += 1
oldDir = newDir
+ if footer:
+ lines.append(footer + '\n')
self.app.more(lines)
***************
*** 463,471 ****
S_DELETED = 'D' # file scheduled for removal has been commited
statusToColorKey = None
! def __init__(self, dir, name, status):
GetSetProvider.__init__(self)
self.dir = dir
self.name = name
self.status = status
if Entry.statusToColorKey is None:
Entry.statusToColorKey = {}
--- 467,476 ----
S_DELETED = 'D' # file scheduled for removal has been commited
statusToColorKey = None
! def __init__(self, dir, name, status, info=''):
GetSetProvider.__init__(self)
self.dir = dir
self.name = name
self.status = status
+ self.info = info
if Entry.statusToColorKey is None:
Entry.statusToColorKey = {}
|