Importing from source packages
==============================

Status: Part Implementation.

Aim
---

When a package has not been maintained in a VCS before the history information
is in the source packages. There will generally be a series of these for each
package.

The plugin should support creating a branch from these files.

Services like snapshot.debian.net can be used to get old versions of a package,
and providing a way to import from them automatically will be a great aid to
maintainers without copies of all of their uploaded packages.

It should also aim to support incremental imports, so that the command can
be used in an extant branch to import a .dsc in to the current state. This
would allow uploads outside of the packaging system to be incorporated.

Design
------

If there are multiple .dscs provided then they should be sorted in to ascending
version number. Then for each it should be imported. If it has an
.orig.tar.gz then it should be imported first on to the upstream branch,
adding a tag for use with new-upstream-release-handling. Then the .diff.gz
should be applied, and the result commited on the packaging branch as a merge
with the upstream.

If there is no .orig.tar.gz the tree should be set at the corresponding
upstream import and the diff applied on to the tree. However the commit should
have a single parent of the last commit on the packaging branch.

Each revision on the packaging branch should be tagged to match the tag
scheme used for uploads.

The revision graph will evolve like this, starting from an empty branch.

  upstream

  packaging

Import the first upstream

  upstream  ---1

  packaging

Add the packaging diff

  upstream  ---1
                \
  packaging      1.1

Add the next packaging diff.

  upstream  ---1
                \
  packaging      1.1---1.2

Then import the next upstream, using the diff to provide the merge commit.

  upstream  ---1-----------2
                \           \
  packaging      1.1---1.2---2.1

and continue on like that until all is imported.

There should be no conflicts, as the merge commits aren't done as merges,
the second parent (along the packaging branch) is just added to represent the
history. In reality the tree of that commit is just the result of applying the
.diff.gz to the .orig.tar.gz, i.e. the package.

Implementation
--------------

Currently there is code that implements the above strategy, but it needs some
more testing and a cleanup. It is also not directly exposed at the UI layer,
but that shouldn't be too hard to do.

There is a tentative import-snapshot command for importing from
snapshot.debian.net, but it is more for testing and will probably become an
option of import-dsc.

Also left to do is implementations for other modes, especially native. Merge
mode is complicated by the fact that the old packages may have changes outside
debian/.

UI
--

Have a command

  bzr deb import-dsc

which imports a set of .dsc files, given on the command line. Can either be
local or remote.

Could also take a file which lists the files to import.

A --snapshot option that supplements the files on the command line
with those stored at snapshot.d.n. This might need to take the name of the
package as an option, but it would be better to avoid that.

An option to name the output branch would be good.

