~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave_commands.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-06-05 04:05:05 UTC
  • mfrom: (3473.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080605040505-i9kqxg2fps2qjdi0
Add the 'alias' command (Tim Penhey)

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
        from bzrlib.weavefile import read_weave
37
37
        from bzrlib.transport import get_transport
38
38
        from bzrlib import osutils
39
 
        vf = read_weave(file(filename, 'rb'))
 
39
        from bzrlib.knit import KnitVersionedFile
 
40
        if filename.endswith('.knit'):
 
41
            transport = get_transport(osutils.dirname(filename))
 
42
            relpath = osutils.basename(filename)[:-len('.knit')]
 
43
            vf = KnitVersionedFile(relpath, transport)
 
44
        else:
 
45
            vf = read_weave(file(filename, 'rb'))
40
46
        names = vf.versions()
41
47
        names.sort()
42
48
        print '\n'.join(names)
43
49
 
44
50
 
 
51
class cmd_weave_join(Command):
 
52
    """Join the contents of two weave files.
 
53
 
 
54
    The resulting weave is sent to stdout.
 
55
 
 
56
    This command is only intended for bzr developer use.
 
57
    """
 
58
 
 
59
    hidden = True
 
60
    takes_args = ['weave1', 'weave2']
 
61
 
 
62
    def run(self, weave1, weave2):
 
63
        from bzrlib.weavefile import read_weave, write_weave
 
64
        w1 = read_weave(file(weave1, 'rb'))
 
65
        w2 = read_weave(file(weave2, 'rb'))
 
66
        w1.join(w2)
 
67
        write_weave(w1, sys.stdout)
 
68
 
 
69
 
45
70
class cmd_weave_plan_merge(Command):
46
71
    """Show the plan for merging two versions within a weave"""
47
72
    hidden = True