bzr support in meld broken + patch
- From: Martijn Faassen <faassen startifact com>
- To: meld-list gnome org
- Subject: bzr support in meld broken + patch
- Date: Tue, 19 Dec 2006 19:16:06 +0100
Hi there,
Let me start out saying what many others have likely said already: meld
really makes my version control life a lot earlier. Thanks!
Today I was playing around with bzr and to my pleasant surprise I
noticed that meld seemed to have support for it. Unfortunately I also
think it's currently broken - the file browser doesn't appear to
recognize any modified file and on the command line I see the following
error message:
bzr: ERROR: no such option: --all
which is probably the cause of the underlying problem. I just looked it
up and it appears now the --all behavior is always implied by the 'bzr
status' command, so going into vc/bzr.py and removing the --all seems to
have fixed this problem.
I'm less sure about the following. There appears to be a problem with
meld not recognizing which files are under version control and which are
not: the 'normal' button shows *all* files, including .pyc files and
foo~ files. With svn it would not show those files, as they're in the
svn ignores. With bzr it does. I'm not sure what the semantics of
lookup_files should be in this respect. It appears that in case of svn,
the semantics are what I would prefer: ignore anything svn is ignoring
anyway. With the bzr backend, it's not following the ignore rules of bzr.
I've just hacked up some code to make that work, so attached is a rough
patch of bzr.py. It fixes the --all issue and also ignores files
according to the .bzrignore.
Thanks again for meld and I hope my patch is useful!
Regards,
Martijn
27a28
> import fnmatch
65a67,69
> def branch_root(self, rootdir):
> return os.popen("bzr root %s" % rootdir).read().rstrip('\n')
>
67c71
< branch_root = os.popen("bzr root %s" % rootdir).read().rstrip('\n')
---
> branch_root = self.branch_root(rootdir)
70c74
< proc = os.popen("bzr status --all %s" % branch_root)
---
> proc = os.popen("bzr status %s" % branch_root)
110c114,116
<
---
> ignore_pattern = IgnorePattern(
> os.path.join(self.branch_root(directory), '.bzrignore'))
>
128,129c134,137
< #state = ignore_re.match(f) == None and _vc.STATE_NONE or _vc.STATE_IGNORED
< state = _vc.STATE_NORMAL
---
> if ignore_pattern.match(f):
> state = _vc.STATE_IGNORED
> else:
> state = _vc.STATE_NORMAL
133,134c141,144
< #state = ignore_re.match(f) == None and _vc.STATE_NONE or _vc.STATE_IGNORED
< state = _vc.STATE_NORMAL
---
> if ignore_pattern.match(d):
> state = _vc.STATE_IGNORED
> else:
> state = _vc.STATE_NORMAL
137a148,162
> class IgnorePattern(object):
> def __init__(self, bzrignore):
> try:
> f = open(bzrignore, 'r')
> self.ignore_patterns = [line.strip() for line in f.readlines()]
> f.close()
> except IOError:
> self.ignore_patterns = []
>
> def match(self, s):
> for pattern in self.ignore_patterns:
> if fnmatch.fnmatch(s, pattern):
> return True
> return False
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]