diff options
author | Guido van Rossum <guido@python.org> | 1995-07-18 18:34:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-07-18 18:34:34 (GMT) |
commit | a79f5a32569a19454e604822e4efe0b48e18394b (patch) | |
tree | 5b9237a0da617f916edb43e3f04982e51d607215 /Demo/pdist | |
parent | cf1025ba0db6a251b2fa681cc95eaa7490a60cb3 (diff) | |
download | cpython-a79f5a32569a19454e604822e4efe0b48e18394b.zip cpython-a79f5a32569a19454e604822e4efe0b48e18394b.tar.gz cpython-a79f5a32569a19454e604822e4efe0b48e18394b.tar.bz2 |
implemented 'add' command and commit for added files
Diffstat (limited to 'Demo/pdist')
-rwxr-xr-x | Demo/pdist/rcvs.py | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/Demo/pdist/rcvs.py b/Demo/pdist/rcvs.py index 46f41a8..f7cdb41 100755 --- a/Demo/pdist/rcvs.py +++ b/Demo/pdist/rcvs.py @@ -8,11 +8,10 @@ # - if the remote file is deleted, "rcvs update" will fail # # Functionality: +# - cvs log +# - cvs rm # - descend into directories (alraedy done for update) -# - cvs add; cvs rm -# - commit new files # - conflict resolution -# - cvs log # - other relevant commands? # - branches # @@ -191,7 +190,8 @@ class MyFile(File): def put(self, message = ""): print "Checking in", self.file, "..." data = open(self.file).read() - self.proxy.lock(self.file) + if not self.enew: + self.proxy.lock(self.file) messages = self.proxy.put(self.file, data, message) if messages: print messages @@ -204,6 +204,16 @@ class MyFile(File): f.close() self.setentry(self.rrev, self.rsum) + def add(self): + self.eseen = 0 # While we're hacking... + self.esum = self.lsum + self.emtime, self.ectime = 0, 0 + self.erev = '' + self.enew = 1 + self.edeleted = 0 + self.eseen = 1 # Done + self.extra = '' + def setentry(self, erev, esum): self.eseen = 0 # While we're hacking... self.esum = esum @@ -252,9 +262,11 @@ class RCVS(CVS): return if not message: message = raw_input("One-liner: ") + committed = [] for e in list: + committed.append(e.file) e.commit(message) - self.mailinfo(files, message) + self.mailinfo(committed, message) def mailinfo(self, files, message = ""): towhom = "sjoerd@cwi.nl, jack@cwi.nl" # XXX @@ -283,6 +295,25 @@ class RCVS(CVS): for e in self.whichentries(files): e.diff(opts) + def add(self, files): + if not files: + raise RuntimeError, "'cvs add' needs at least one file" + list = [] + for e in self.whichentries(files, 1): + code = e.action() + print code, e.file + e.report() + e.add() + code = e.action() + print code, e.file + e.report() + print '='*20 + + def rm(self, files): + if not files: + raise RuntimeError, "'cvs rm' needs at least one file" + raise RuntimeError, "'cvs rm' not yet imlemented" + def whichentries(self, files, localfilestoo = 0): if files: list = [] @@ -367,6 +398,9 @@ class rcvs(CommandFrameWork): def default(self): self.cvs.report([]) + def do_report(self, opts, files): + self.cvs.report(files) + def do_update(self, opts, files): """update [-l] [-R] [file] ...""" local = DEF_LOCAL @@ -399,6 +433,24 @@ class rcvs(CommandFrameWork): do_dif = do_diff flags_dif = flags_diff + def do_add(self, opts, files): + """add file ...""" + if not files: + print "'rcvs add' requires at least one file" + return + self.cvs.add(files) + self.cvs.putentries() + + def do_remove(self, opts, files): + """remove file ...""" + if not files: + print "'rcvs remove' requires at least one file" + return + self.cvs.remove(files) + self.cvs.putentries() + do_rm = do_remove + + def remove(fn): |