[PATCH] baz2bzr: workaround baz ancestry-graph bug

Aaron Bentley abentley at panoramicfeedback.com
Mon Oct 17 01:43:55 BST 2005


Could you split this out into another function?  e.g. "def
iter_ancestors(revision, meetoo)"?  Or perhaps it would make sense to
stick in PyBaz?

Aaron

David Allouche wrote:
> This patch works around a bug of baz where ancestry-graph fails for old
> branches which have no cached ancestry data and when the arch-cache does
> not contain the required information.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> === modified file 'baz_import.py'
> --- baz_import.py
> +++ baz_import.py
> @@ -222,7 +222,22 @@
>              raise NoSuchVersion(version)
>          else:
>              raise
> -    ancestors = list(revision.iter_ancestors(metoo=True))
> +    try:
> +        ancestors = list(revision.iter_ancestors(metoo=True))
> +    except pybaz.ExecProblem, exception:
> +        error = exception.proc.error
> +        if error is None:
> +            raise
> +        if not error.startswith(
> +                'baz: uncaught exception: 2:(Could not retrieve ancestor)\n'):
> +            raise
> +        # run "ancestry" within a checkout to fill the arch-cache
> +        temp_path = tempfile.mktemp()
> +        revision.get(temp_path)
> +        pybaz.backend.null_cmd(['ancestry'], chdir=temp_path)
> +        shutil.rmtree(temp_path)
> +        # run ancestry-graph again, with a filled cache
> +        ancestors = list(revision.iter_ancestors(metoo=True))
>      ancestors.reverse()
>      return ancestors
>  
> 





More information about the bazaar mailing list