2
2
# -*- encoding: utf-8 -*-
3
3
# Copyright (C) 2007, 2008, 2009 Guillermo Gonzalez
5
# The code taken from bzrlib is under: Copyright (C) 2005, 2006, 2007 Canonical Ltd
5
# The code taken from bzrlib is under: Copyright (C) 2005-2007 Canonical Ltd
7
7
# This program is free software; you can redistribute it and/or modify
8
8
# it under the terms of the GNU General Public License as published by
64
63
Each group can have multiple child's of this element's:
66
65
<file [oldpath] [oldkind, newkind] [fid]>
67
66
<directory [oldpath] [oldkind, newkind] [suffix]>
70
69
<status workingtree_root="/home/guillo/Unison-root/sandbox/bazaar/bzr/0.15/">
72
71
<file oldpath="INSTALL" >INSTALL.txt</file>
86
By default this compares the working tree to a previous revision.
87
If the revision argument is given, summarizes changes between the
85
By default this compares the working tree to a previous revision.
86
If the revision argument is given, summarizes changes between the
88
87
working tree and another, or between two revisions.
90
The result is written out as Unicode and to_file should be able
89
The result is written out as Unicode and to_file should be able
93
92
If showing the status of a working tree, extra information is included
94
93
about unknown files, conflicts, and pending merges.
96
:param show_unchanged: Deprecated parameter. If set, includes unchanged
95
:param show_unchanged: Deprecated parameter. If set, includes unchanged
98
97
:param specific_files: If set, a list of filenames whose status should be
99
shown. It is an error to give a filename that is not in the working
98
shown. It is an error to give a filename that is not in the working
100
99
tree, or in the working inventory or in the basis inventory.
101
100
:param show_ids: If set, includes each file's id.
102
101
:param to_file: If set, write to this file (default stdout.)
162
161
delta.unversioned if not new.is_ignored(unversioned[0])]
163
162
show_tree_xml(delta, to_file,
164
163
show_ids=show_ids,
165
show_unchanged=show_unchanged,
164
show_unchanged=show_unchanged,
166
165
show_unversioned=want_unversioned)
167
# show the new conflicts only for now. XXX: get them from the
166
# show the new conflicts only for now. XXX: get them from the
169
168
conflicts = new.conflicts()
170
169
if specific_files is not None:
173
172
if len(conflicts) > 0:
174
173
to_file.write("<conflicts>")
175
174
for conflict in conflicts:
176
to_file.write('<conflict type="%s">%s</conflict>' %
177
(conflict.typestring, _escape_cdata(conflict.path)))
175
to_file.write('<conflict type="%s">%s</conflict>' %
176
(conflict.typestring,
177
_escape_cdata(conflict.path)))
178
178
to_file.write("</conflicts>")
180
180
to_file.write('<nonexistents>')
196
196
parents = new.get_parent_ids()
197
197
if len(parents) < 2:
200
200
pending = parents[1:]
201
201
branch = new.branch
202
202
last_revision = parents[0]
203
203
to_file.write('<pending_merges>')
204
# TODO: this could be improved using merge_sorted - we'd get the same
204
# TODO: this could be improved using merge_sorted - we'd get the same
205
205
# output rather than one level of indent.
206
206
graph = branch.repository.get_graph()
207
207
other_revisions = [last_revision]
213
213
show_ghost(to_file, merge)
214
214
other_revisions.append(merge)
217
217
# Log the merge, as it gets a slightly different formatting
218
218
to_file.write(logxml.line_log(rev))
219
219
# Find all of the revisions in the merge source, which are not in the
236
236
revisions[revision_id] = None
238
238
revisions[revision_id] = rev
240
240
# Display the revisions brought in by this merge.
241
241
rev_id_iterator = status._get_sorted_revisions(merge, merge_extra,
242
242
branch.repository.get_parent_map(merge_extra))
273
273
if len(item) == 5 and item[4]:
278
kind_id=get_kind_id_element(kind, fid)
279
to_file.write('<%s %s>%s</%s>' % (kind, kind_id,
278
kind_id = get_kind_id_element(kind, fid)
279
to_file.write('<%s %s>%s</%s>' % (kind, kind_id,
280
280
_escape_cdata(path), kind))
282
282
to_file.write('<%s>%s</%s>' % (kind, _escape_cdata(path), kind))
285
285
to_file.write('<removed>')
286
286
show_list(delta.removed)
287
287
to_file.write('</removed>')
290
290
to_file.write('<added>')
291
291
show_list(delta.added)
292
292
to_file.write('</added>')
294
294
extra_modified = []
295
295
if delta.renamed:
296
296
to_file.write('<renamed>')
297
for (oldpath, newpath, fid, kind,
297
for (oldpath, newpath, fid, kind,
298
298
text_modified, meta_modified) in delta.renamed:
299
299
if text_modified or meta_modified:
300
extra_modified.append((newpath, fid, kind,
300
extra_modified.append((newpath, fid, kind,
301
301
text_modified, meta_modified))
302
302
metamodified = ''
303
303
if meta_modified:
304
304
metamodified = 'meta_modified="true"'
308
kind_id=get_kind_id_element(kind, fid)
308
kind_id = get_kind_id_element(kind, fid)
309
309
to_file.write('<%s oldpath="%s" %s %s>%s</%s>' % \
310
(kind, _escape_cdata(oldpath), metamodified,
310
(kind, _escape_cdata(oldpath), metamodified,
311
311
kind_id, _escape_cdata(newpath), kind))
313
313
to_file.write('<%s oldpath="%s" %s >%s</%s>' % \
314
(kind, _escape_cdata(oldpath), metamodified,
314
(kind, _escape_cdata(oldpath), metamodified,
315
315
_escape_cdata(newpath), kind))
316
316
to_file.write('</renamed>')
325
325
to_file.write('<%s oldkind="%s" %s>%s</%s>' % \
326
(new_kind, old_kind, suffix,
326
(new_kind, old_kind, suffix,
327
327
_escape_cdata(path), new_kind))
328
328
to_file.write('</kind_changed>')
332
332
show_list(delta.modified)
333
333
show_list(extra_modified)
334
334
to_file.write('</modified>')
336
336
if show_unchanged and delta.unchanged:
337
337
to_file.write('<unchanged>')
338
338
show_list(delta.unchanged)
344
344
to_file.write('</unknown>')
346
346
def get_kind_id_element(kind, fid):
348
348
if kind == 'directory':
349
kind_id='suffix="%s"' % fid
349
kind_id = 'suffix="%s"' % fid
350
350
elif kind == 'symlink':
353
kind_id='fid="%s"' %fid
353
kind_id = 'fid="%s"' % fid