suggested patch for version checking in bzrtools and gtk plugins

John Arbash Meinel john at arbash-meinel.com
Wed Jun 6 17:04:10 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Elliot Murphy wrote:
> Hi!
> 
> I quite agree with the version checking that is done in the gtk and bzrtools plugins. However, there is one case when I believe that the warnings are excessive: when I'm using the very latest bzrtools and gtk plugins, along with bzr.dev.
> 
> Here is a proposed patch which also checks for whether something is a "dev" version, and does not print the warning when you are running +1dev.  When looking at this it strikes me that perhaps bzrlib itself should offer a version checking function for plugins to use. Plugins of course would be free to provide their own, but it doesn't make sense to have this code duplicated in every plugin that wants to do version checking.
> 
> For gtk:
> === modified file '__init__.py'
> --- __init__.py 2007-05-19 16:21:10 +0000
> +++ __init__.py 2007-06-06 14:49:02 +0000
> @@ -45,7 +45,13 @@
>          warning('bzr-gtk is not up to date with installed bzr version %s.'
>                  ' \nThere should be a newer version available, e.g. %i.%i.'
>                  % (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
> -        if bzrlib_version != desired_plus:
> +        if bzrlib_version == desired_plus:
> +            # allow people to run the next dev version without spewing warnings
> +            if bzrlib.version_info[3] != "dev":
> +                warning('bzr-gtk is not up to date with installed bzr version %s.'
> +                        ' \nThere should be a newer version available, e.g. %i.%i.'
> +                        % (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
> +        else:
>              raise Exception, 'Version mismatch'

^- I think you forgot to delete the existing warning before the version check.

Otherwise I agree that these would be good to include (though I do not
specifically develop on those projects).

I'm curious how the helper in bzrlib should look like. So far I see:

1) Ability to check whether the versions match, and issue a warning if there is
a problem.

2) Ability to not warn if the versions are "close" and both sides are "dev"
versions.

3) Some way of manually disabling the warning, possibly for a specific plugin +
version pair. (Or maybe just disabling them altogether). (For users who know
that 0.17 is compatible with 0.18, and would you please stop annoying me TYVM)

Any other design constraints?

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZtr5JdeBCYSNAAMRAps3AJ46Hpq+e7K/xD2y2eHDdL6EN+sNowCfXb6L
wXLS6vbgojwdZ2+qYHcTyCQ=
=fvkr
-----END PGP SIGNATURE-----



More information about the bazaar mailing list