1995-04-27 18:07:07 +00:00
|
|
|
#! /usr/local/bin/python
|
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
"""Remote CVS -- command line interface"""
|
1995-04-27 18:07:07 +00:00
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
from cvslib import CVS, File
|
1995-04-26 22:57:11 +00:00
|
|
|
import md5
|
|
|
|
import os
|
|
|
|
import string
|
|
|
|
import sys
|
1995-04-27 23:33:43 +00:00
|
|
|
from cmdfw import CommandFrameWork
|
1995-04-26 22:57:11 +00:00
|
|
|
|
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
class MyFile(File):
|
1995-04-26 22:57:11 +00:00
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
def update(self):
|
|
|
|
print self.file, '...'
|
|
|
|
if self.lsum == self.esum == self.rsum:
|
|
|
|
print '=', self.file
|
|
|
|
return
|
|
|
|
if self.lsum and not self.erev and not self.rrev:
|
|
|
|
print '?', self.file
|
|
|
|
return
|
|
|
|
print 'X', self.file
|
|
|
|
|
1995-04-26 22:57:11 +00:00
|
|
|
|
1995-04-27 18:07:07 +00:00
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
class RCVS(CVS):
|
1995-04-27 18:07:07 +00:00
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
FileClass = MyFile
|
1995-04-27 18:07:07 +00:00
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
def __init__(self):
|
|
|
|
CVS.__init__(self)
|
1995-04-27 18:07:07 +00:00
|
|
|
|
1995-04-27 23:33:43 +00:00
|
|
|
def checkfiles(self, files):
|
|
|
|
if not files:
|
|
|
|
def ok(file, self=self):
|
|
|
|
e = self.entries[file]
|
|
|
|
return e.eseen or e.rseen
|
|
|
|
files[:] = filter(ok, self.entries.keys())
|
|
|
|
files.sort()
|
|
|
|
|
|
|
|
|
|
|
|
class rcvs(CommandFrameWork):
|
|
|
|
|
|
|
|
GlobalFlags = 'd:h:p:qv'
|
|
|
|
UsageMessage = \
|
|
|
|
"usage: rcvs [-d directory] [-h host] [-p port] [-q] [-v] subcommand arg ..."
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
"""Constructor."""
|
|
|
|
CommandFrameWork.__init__(self)
|
|
|
|
self.proxy = None
|
|
|
|
self.cvs = RCVS()
|
|
|
|
|
|
|
|
def options(self, opts):
|
|
|
|
self.opts = opts
|
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
import rcsclient
|
|
|
|
self.proxy = rcsclient.openrcsclient(self.opts)
|
|
|
|
self.cvs.setproxy(self.proxy)
|
|
|
|
self.cvs.getentries()
|
|
|
|
self.cvs.getlocalfiles()
|
|
|
|
self.cvs.getremotefiles(self.proxy)
|
|
|
|
|
|
|
|
def default(self):
|
|
|
|
self.cvs.report()
|
|
|
|
|
|
|
|
def do_update(self, opts, files):
|
|
|
|
self.cvs.checkfiles(files)
|
|
|
|
if not files:
|
|
|
|
print "no files"
|
1995-04-26 22:57:11 +00:00
|
|
|
return
|
1995-04-27 23:33:43 +00:00
|
|
|
for file in files:
|
|
|
|
if not self.cvs.entries.has_key(file):
|
|
|
|
print "%s: not found" % file
|
|
|
|
else:
|
|
|
|
self.cvs.entries[file].update()
|
1995-04-26 22:57:11 +00:00
|
|
|
|
|
|
|
|
1995-04-27 21:28:53 +00:00
|
|
|
def main():
|
1995-04-27 23:33:43 +00:00
|
|
|
rcvs().run()
|
1995-04-27 18:07:07 +00:00
|
|
|
|
1995-04-26 22:57:11 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
1995-04-27 21:28:53 +00:00
|
|
|
main()
|