/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to processors/generic_processor.py

move single_plural into helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
# How many commits before automatically checkpointing
46
46
_DEFAULT_AUTO_CHECKPOINT = 10000
47
47
 
48
 
def _single_plural(n, single, plural):
49
 
    """Return a single or plural form of a noun based on number."""
50
 
    if n == 1:
51
 
        return single
52
 
    else:
53
 
        return plural
54
 
 
55
 
 
56
48
class GenericProcessor(processor.ImportProcessor):
57
49
    """An import processor that handles basic imports.
58
50
 
164
156
        bc = self._branch_count
165
157
        tc = self._tag_count
166
158
        note("Imported %d %s into %d %s with %d %s.",
167
 
            rc, _single_plural(rc, "revision", "revisions"),
168
 
            bc, _single_plural(bc, "branch", "branches"),
169
 
            tc, _single_plural(tc, "tag", "tags"))
 
159
            rc, helpers.single_plural(rc, "revision", "revisions"),
 
160
            bc, helpers.single_plural(bc, "branch", "branches"),
 
161
            tc, helpers.single_plural(tc, "tag", "tags"))
170
162
 
171
163
    def note(self, msg, *args):
172
164
        """Output a note but timestamp it."""