  In this article we realize T-duality as a geometric transform of bundles of
abelian group stacks. The transform applies in the algebro-geometric setting as
well as the topological setting, and thus makes precise the link between the
models of T-duality in these two settings, which are superficially quite
different. The transform is also valid for torus bundles with affine structure
group, and thus provides a constructive method of producing T-duals in the
affine case.
