From: Eric S. Raymond Date: Thu, 11 Nov 2010 02:37:49 +0000 (-0500) Subject: More removal of unused code. X-Git-Tag: 0.1~70 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=b0c3b56aa1ac1125831758fd9792dc857eaa73a8;p=rcs-fast-import.git More removal of unused code. --- diff --git a/rcs-fast-import b/rcs-fast-import index eedac30..446caba 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -138,13 +138,6 @@ class Date: def rfc822(self): "Format as an RFC822 timestamp." return time.strftime("%a %d %b %Y %H:%M:%S", time.localtime(self.timestamp)) + " " + self.timezone - def delta(self, other): - return other.timestamp - self.timestamp - def __str__(self): - "Format as a git timestamp." - return str(self.timestamp) + " " + self.timezone - def __cmp__(self, other): - return cmp(self.timestamp, other.timestamp) class Attribution: "Represents an attribution of a repo action to a person and time." @@ -162,13 +155,6 @@ class Attribution: self.date = Date(person.strip().split("|")[2]) except (ValueError, IndexError): raise FatalException("malformed attribution %s" % person) - def __eq__(self, other): - "Compare attributions after canonicalization." - return (self.name == other.name - and self.email == other.email - and self.date == other.date) - def __str__(self): - return self.name + " <" + self.email + "> " + str(self.date) class Blob: "Represent a detached blob of data referenced by a mark." @@ -179,13 +165,6 @@ class Blob: self.color = None def blobfile(self): return self.repo.subdir() + "/blob-" + `id(self)` + "-" + self.mark - def release(self): - os.remove(self.blobfile()) - self.path = None # Marked for deletion - def __str__(self): - with open(self.blobfile()) as dp: - content = dp.read() - return "blob\nmark %s\ndata %d\n%s\n" % (self.mark, len(content), content) class Tag: "Represents an annotated tag." @@ -194,13 +173,6 @@ class Tag: self.committish = committish self.tagger = tagger self.comment = content - self.color = None - def __str__(self): - st = "tag %s\nfrom %s\n" % (self.name, self.committish) - if self.tagger: - st += "tagger %s\n" % self.tagger - st += "data %d\n%s\n" % (len(self.comment), self.comment,) - return st class Reset: "Represents a branch creation." @@ -239,12 +211,6 @@ class Commit: self.branch = None # branch name self.fileops = [] # blob and file operation list self.properties = {} # commit properties (extension) - def children(self): - "Get a list of this commit's children." - return filter(lambda e:self.mark in e.parent_marks,self.repo.commits()) - def parents(self): - "Get a list of this commit's parents." - return filter(lambda e:e.mark in self.parent_marks,self.repo.commits()) class Passthrough: "Represents a passthrough line." @@ -269,8 +235,6 @@ class Repository: self.branches = set([]) self.import_line = 0 self.inline_count = 0 - self.preserve_set = set([]) - self.case_coverage = set([]) self.basedir = os.getcwd() def cleanup(self): nuke(self.subdir(), "rcs-fast-import: cleaning up %s" % self.subdir()) @@ -499,9 +463,6 @@ class Repository: except KeyboardInterrupt: nuke(self.subdir(), "rcs-fast-import: import interrupted, removing %s" % self.subdir()) raise KeyboardInterrupt - def commits(self): - "Return a list of the repository commit objects." - return filter(lambda e: isinstance(e, Commit), self.events) # Container emulation methods def __len__(self): return len(self.events) @@ -545,6 +506,7 @@ class popen_or_die: raise FatalException("%s%s returned error." \ % (self.cmd, self.legend)) return False + def do_or_die(cmd, legend=""): "Either execute a command or raise a fatal exception." if legend: