]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rrcs.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Demo / pdist / rrcs.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rrcs.py b/AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rrcs.py
deleted file mode 100644 (file)
index ede0051..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#! /usr/bin/env python\r
-\r
-"Remote RCS -- command line interface"\r
-\r
-import sys\r
-import os\r
-import getopt\r
-import string\r
-import md5\r
-import tempfile\r
-from rcsclient import openrcsclient\r
-\r
-def main():\r
-    sys.stdout = sys.stderr\r
-    try:\r
-        opts, rest = getopt.getopt(sys.argv[1:], 'h:p:d:qvL')\r
-        if not rest:\r
-            cmd = 'head'\r
-        else:\r
-            cmd, rest = rest[0], rest[1:]\r
-        if not commands.has_key(cmd):\r
-            raise getopt.error, "unknown command"\r
-        coptset, func = commands[cmd]\r
-        copts, files = getopt.getopt(rest, coptset)\r
-    except getopt.error, msg:\r
-        print msg\r
-        print "usage: rrcs [options] command [options] [file] ..."\r
-        print "where command can be:"\r
-        print "      ci|put      # checkin the given files"\r
-        print "      co|get      # checkout"\r
-        print "      info        # print header info"\r
-        print "      head        # print revision of head branch"\r
-        print "      list        # list filename if valid"\r
-        print "      log         # print full log"\r
-        print "      diff        # diff rcs file and work file"\r
-        print "if no files are given, all remote rcs files are assumed"\r
-        sys.exit(2)\r
-    x = openrcsclient(opts)\r
-    if not files:\r
-        files = x.listfiles()\r
-    for fn in files:\r
-        try:\r
-            func(x, copts, fn)\r
-        except (IOError, os.error), msg:\r
-            print "%s: %s" % (fn, msg)\r
-\r
-def checkin(x, copts, fn):\r
-    f = open(fn)\r
-    data = f.read()\r
-    f.close()\r
-    new = not x.isvalid(fn)\r
-    if not new and same(x, copts, fn, data):\r
-        print "%s: unchanged since last checkin" % fn\r
-        return\r
-    print "Checking in", fn, "..."\r
-    message = asklogmessage(new)\r
-    messages = x.put(fn, data, message)\r
-    if messages:\r
-        print messages\r
-\r
-def checkout(x, copts, fn):\r
-    data = x.get(fn)\r
-    f = open(fn, 'w')\r
-    f.write(data)\r
-    f.close()\r
-\r
-def lock(x, copts, fn):\r
-    x.lock(fn)\r
-\r
-def unlock(x, copts, fn):\r
-    x.unlock(fn)\r
-\r
-def info(x, copts, fn):\r
-    dict = x.info(fn)\r
-    keys = dict.keys()\r
-    keys.sort()\r
-    for key in keys:\r
-        print key + ':', dict[key]\r
-    print '='*70\r
-\r
-def head(x, copts, fn):\r
-    head = x.head(fn)\r
-    print fn, head\r
-\r
-def list(x, copts, fn):\r
-    if x.isvalid(fn):\r
-        print fn\r
-\r
-def log(x, copts, fn):\r
-    flags = ''\r
-    for o, a in copts:\r
-        flags = flags + ' ' + o + a\r
-    flags = flags[1:]\r
-    messages = x.log(fn, flags)\r
-    print messages\r
-\r
-def diff(x, copts, fn):\r
-    if same(x, copts, fn):\r
-        return\r
-    flags = ''\r
-    for o, a in copts:\r
-        flags = flags + ' ' + o + a\r
-    flags = flags[1:]\r
-    data = x.get(fn)\r
-    tf = tempfile.NamedTemporaryFile()\r
-    tf.write(data)\r
-    tf.flush()\r
-    print 'diff %s -r%s %s' % (flags, x.head(fn), fn)\r
-    sts = os.system('diff %s %s %s' % (flags, tf.name, fn))\r
-    if sts:\r
-        print '='*70\r
-\r
-def same(x, copts, fn, data = None):\r
-    if data is None:\r
-        f = open(fn)\r
-        data = f.read()\r
-        f.close()\r
-    lsum = md5.new(data).digest()\r
-    rsum = x.sum(fn)\r
-    return lsum == rsum\r
-\r
-def asklogmessage(new):\r
-    if new:\r
-        print "enter description,",\r
-    else:\r
-        print "enter log message,",\r
-    print "terminate with single '.' or end of file:"\r
-    if new:\r
-        print "NOTE: This is NOT the log message!"\r
-    message = ""\r
-    while 1:\r
-        sys.stderr.write(">> ")\r
-        sys.stderr.flush()\r
-        line = sys.stdin.readline()\r
-        if not line or line == '.\n': break\r
-        message = message + line\r
-    return message\r
-\r
-def remove(fn):\r
-    try:\r
-        os.unlink(fn)\r
-    except os.error:\r
-        pass\r
-\r
-commands = {\r
-        'ci': ('', checkin),\r
-        'put': ('', checkin),\r
-        'co': ('', checkout),\r
-        'get': ('', checkout),\r
-        'info': ('', info),\r
-        'head': ('', head),\r
-        'list': ('', list),\r
-        'lock': ('', lock),\r
-        'unlock': ('', unlock),\r
-        'log': ('bhLRtd:l:r:s:w:V:', log),\r
-        'diff': ('c', diff),\r
-        }\r
-\r
-if __name__ == '__main__':\r
-    main()\r