Re: Bug with large output on vc commands



On 11 December 2012 10:38, louis <louis obsidian com au> wrote:
> So the issue was actually a bzr issue again (restraining self from bad
> pun...)
> It's using status instead of a MUCH quicker info to check if this directory
> is a bzr branch.
> It was blocking if the return value from status was large (ie lots of
> changes in the branch)
> I have confirmed that the exit codes from info are non-zero if the directory
> is not a bzr branch, so this works successfully.
>
> diff --git a/meld/vc/bzr.py b/meld/vc/bzr.py
> index de16784..4a71e13 100644
> --- a/meld/vc/bzr.py
> +++ b/meld/vc/bzr.py
> @@ -75,7 +75,7 @@ class Vc(_vc.CachedVc):
>      def resolved_command(self):
>          return [self.CMD] + self.CMDARGS + ["resolve"]
>      def valid_repo(self):
> -        if _vc.call([self.CMD, "status"], cwd=self.root):
> +        if _vc.call([self.CMD, "info"], cwd=self.root):
>              return False
>          else:
>              return True

So looking at history, we already changed from 'check' to 'status' a
while ago to make it faster.
    https://bugzilla.gnome.org/show_bug.cgi?id=653302

The idea is that valid_repo() should tell us whether we're actually
operating in something that bzr recognises as a valid repository. Do
you think that 'bzr info' is good enough as far as that kind of check
goes? Basically, we want to know that further bzr calls on that path
will actually do something sensible.

> As an aside, I was unaware of os.devnull - is this safe for cross platform?

Yes: http://docs.python.org/2/library/os.html#os.devnull

In fact, I might just go ahead and commit that change I posted earlier
and see if anything breaks; nothing should, but... yeah.

cheers,
Kai


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]