~monodevelop-bzr/monodevelop-bzr/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Copyright (C) 2008 by Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com>
#        
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#    
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#   
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

import clr

import System
import System.Collections.Generic
import System.Reflection
import System.IO
import sys

from System import *
from System.Collections.Generic import *
from System.Reflection import *
from System.IO import *

sys.path.append(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))

# HACK - Do this a better way later
sys.path.append('/usr/lib/python2.4')
sys.path.append('/usr/lib/python2.4/site-packages')

import site

clr.AddReference('MonoDevelop.VersionControl.Bazaar.dll')
import MonoDevelop.VersionControl.Bazaar
from MonoDevelop.VersionControl.Bazaar import *

import bzrlib
from bzrlib import api



class BazaarLibClientReal(MonoDevelop.VersionControl.Bazaar.BazaarClient):
	# public abstract string Version{ get; }
	@property
	def Version(self):
		ver = '.'.join(map(lambda x: str(x), api.get_current_api_version(None)))
		print('Version: ' + ver)
		return ver

	# public abstract IList<string> List (string path, bool recurse, ListKind kind);
	def List(self, path, recurse, kind):
		print('List: ' + path + ' ' + recurse + ' ' + kind)
		files = List[str]()
		
		return files

	# public abstract IList<LocalStatus> Status (string path, BazaarRevision revision);
	def Status(self, path, revision):
		print('Status: ' + path + ' ' + revision)
		return List[LocalStatus]()

	# public abstract string GetPathUrl (string path);
	def GetPathUrl(self, path):
		print('GetPathUrl: ' + path)
		return ''

	# public abstract void Update (string localPath, bool recurse, IProgressMonitor monitor);
	def Update(self, localPath, recurse, monitor):
		print('Update: ' + localPath + ' ' + recurse + ' ' + monitor)

	# public abstract void Revert (string localPath, bool recurse, IProgressMonitor monitor, BazaarRevision toRevision);
	def Revert(self, localPath, recurse, monitor, toRevision):
		print('Revert: ' + localPath + ' ' + recurse + ' ' + monitor + ' ' + toRevision)

	# public abstract void Add (string localPath, bool recurse, IProgressMonitor monitor);
	def Add(self, localPath, recurse, monitor):
		print('Add: ' + localPath + ' ' + recurse + ' ' + monitor)

	# public abstract void Checkout (string url, string targetLocalPath, BazaarRevision rev, bool recurse, IProgressMonitor monitor);
	def Checkout(self, url, targetLocalPath, rev, recurse, monitor):
		print('Checkout: ' + url + ' ' + targetLocalPath + ' ' + rev + ' ' + recurse + ' ' + monitor)

	# public abstract string GetTextAtRevision (string path, BazaarRevision rev);
	def GetTextAtRevision(self, path, rev):
		print('GetTextAtRevision: ' + path + ' ' + rev)
		return ''

	# public abstract BazaarRevision[] GetHistory (BazaarRepository repo, string localFile, BazaarRevision since);
	def GetHistory(self, repo, localFile, since):
		print('GetHistory: ' + repo + ' ' + localFile + ' ' + since)
		return Array[BazaarRevision]()
		
	# public abstract void Merge (string path, BazaarRevision start, BazaarRevision end, IProgressMonitor monitor);
	def Merge(self, path, start, end, monitor):
		print('Merge: ' + path + ' ' + start + ' ' + end + ' ' + monitor)

	# public abstract void Push (string pushLocation, string localPath, IProgressMonitor monitor);
	def Push(self, pushLocation, localPath, monitor):
		print('Push: ' + pushLocation + ' ' + localPath + ' ' + monitor)

	# public abstract void Commit (ChangeSet changeSet, IProgressMonitor monitor);
	def Commit(self, changeSet, monitor):
		print('Commit: ' + changeSet + ' ' + monitor)

	# public abstract DiffInfo[] Diff (string basePath, string[] files);
	def Diff(self, basePath, files):
		print('Diff: ' + basePath + ' ' + files)
		return Array[DiffInfo]()

	# public abstract void Remove (string path, bool force, IProgressMonitor monitor);
	def Remove(self, path, force, monitor):
		print('Remove: ' + path + ' ' + force + ' ' + monitor)