summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-09-04 16:07:12 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-09-04 16:07:12 +0200
commit0cd110edf2de46e972c5bef8abf88028cdaa4bfe (patch)
tree8973ff638edda3041d16098018307a352b4b1ca6
parentec87be037ad5ab9617dc33266656edfa137d0691 (diff)
downloadpython-fastimport-0cd110edf2de46e972c5bef8abf88028cdaa4bfe.tar.gz
Remove bzr-specific code, whitespace.
-rw-r--r--fastimport/commands.py6
-rw-r--r--fastimport/parser.py24
2 files changed, 12 insertions, 18 deletions
diff --git a/fastimport/commands.py b/fastimport/commands.py
index 7368070..ad72de5 100644
--- a/fastimport/commands.py
+++ b/fastimport/commands.py
@@ -33,12 +33,6 @@ COMMAND_NAMES = ['blob', 'checkpoint', 'commit', 'feature', 'progress',
FILE_COMMAND_NAMES = ['filemodify', 'filedelete', 'filecopy', 'filerename',
'filedeleteall']
-# Bazaar file kinds
-FILE_KIND = 'file'
-DIRECTORY_KIND = 'directory'
-SYMLINK_KIND = 'symlink'
-TREE_REFERENCE_KIND = 'tree-reference'
-
# Feature names
MULTIPLE_AUTHORS_FEATURE = "multiple-authors"
COMMIT_PROPERTIES_FEATURE = "commit-properties"
diff --git a/fastimport/parser.py b/fastimport/parser.py
index ab6efb6..65d0166 100644
--- a/fastimport/parser.py
+++ b/fastimport/parser.py
@@ -204,7 +204,7 @@ class LineBasedParser(object):
def push_line(self, line):
"""Push line back onto the line buffer.
-
+
:param line: the line with no trailing newline
"""
self.lineno -= 1
@@ -212,7 +212,7 @@ class LineBasedParser(object):
def read_bytes(self, count):
"""Read a given number of bytes from the input stream.
-
+
Throws MissingBytes if the bytes are not found.
Note: This method does not read from the line buffer.
@@ -228,14 +228,14 @@ class LineBasedParser(object):
def read_until(self, terminator):
"""Read the input stream until the terminator is found.
-
+
Throws MissingTerminator if the terminator is not found.
Note: This method does not read from the line buffer.
:return: the bytes read up to but excluding the terminator.
"""
-
+
lines = []
term = terminator + '\n'
while True:
@@ -305,7 +305,7 @@ class ImportParser(LineBasedParser):
def iter_file_commands(self):
"""Iterator returning FileCommand objects.
-
+
If an invalid file command is found, the line is silently
pushed back and iteration ends.
"""
@@ -502,7 +502,7 @@ class ImportParser(LineBasedParser):
def _who_when(self, s, cmd, section, accept_just_who=False):
"""Parse who and when information from a string.
-
+
:return: a tuple of (name,email,timestamp,timezone). name may be
the empty string if only an email address was given.
"""
@@ -602,20 +602,20 @@ class ImportParser(LineBasedParser):
def _mode(self, s):
"""Parse a file mode into executable and kind.
-
+
:return (is_executable, kind)
"""
# Note: Output from git-fast-export slightly different to spec
if s in ['644', '100644', '0100644']:
- return False, commands.FILE_KIND
+ return False, 'file'
elif s in ['755', '100755', '0100755']:
- return True, commands.FILE_KIND
+ return True, 'file'
elif s in ['040000', '0040000']:
- return False, commands.DIRECTORY_KIND
+ return False, 'directory'
elif s in ['120000', '0120000']:
- return False, commands.SYMLINK_KIND
+ return False, 'symlink'
elif s in ['160000', '0160000']:
- return False, commands.TREE_REFERENCE_KIND
+ return False, 'tree-reference'
else:
self.abort(errors.BadFormat, 'filemodify', 'mode', s)