1
# Copyright (C) 2005 by Aaron Bentley
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
from bzrlib import Branch
18
from bzrlib.diff import diff_trees
20
bzrlib.trace.create_tracefile([])
22
def has_changes(cur_branch):
23
old_tree = cur_branch.basis_tree()
24
new_tree = cur_branch.working_tree()
25
for file_state, fid, old_name, new_name, kind in \
26
bzrlib.diff_trees(old_tree, new_tree):
27
if file_state not in ('I', '.'):
31
cur_branch = Branch(".")
33
if has_changes(cur_branch):
34
print "Error: This tree has uncommitted changes."
36
location = cur_branch.controlfilename("pull-location")