[Pkg-bazaar-commits] r209 ./bzr-builddeb/people/jdw/dev: The --initial option is now required for initial imports with import-dsc.
James Westby
jw+debian at jameswestby.net
Mon Oct 29 22:04:19 UTC 2007
------------------------------------------------------------
revno: 209
committer: James Westby <jw+debian at jameswestby.net>
branch nick: dev
timestamp: Mon 2007-10-29 22:04:19 +0000
message:
The --initial option is now required for initial imports with import-dsc.
Trying to guess when to do/allow initial imports was too ambiguous, so
require this flag now. I'm not sure whether initial or incremental will be
more used, so I just went for this option.
modified:
__init__.py
debian/changelog
doc/user_manual/native.rst
doc/user_manual/normal.rst
tests/blackbox/test_import_dsc.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2007-10-29 21:17:57 +0000
+++ b/__init__.py 2007-10-29 22:04:19 +0000
@@ -392,7 +392,8 @@
Provide a number of source packages (.dsc files), and they will
be imported to create a branch with history that reflects those
packages. You must provide the --to option with the name of the
- branch that will be created.
+ branch that will be created, and the --initial option to indicate
+ this is an initial import.
If there are packages that are available on snapshot.debian.net
then you can use the --snapshot option to supplement the packages
@@ -400,7 +401,7 @@
of the source package as on snapshot.debian.net as this option,
i.e. to import all versions of apt
- import-dsc --snapshot apt
+ import-dsc --initial --snapshot apt
If you use the --snapshot option then you don't have to provide
any source packages on the command line, and if you omit the
@@ -417,7 +418,7 @@
import a .dsc from an upload done from outside the version control
system you can use this command. In this case you can only specify
one file on the command line, or use a file containing only a single
- filename.
+ filename, and do not use the --initial option.
"""
takes_args = ['files*']
@@ -428,10 +429,13 @@
filename_opt = Option('file', help="File containing URIs of source "
"packages to import.", type=str, argname="filename",
short_name='F')
-
- takes_options = [to_opt, snapshot_opt, filename_opt]
-
- def run(self, files_list, to=None, snapshot=None, filename=None):
+ initial_opt = Option('initial',
+ help="Perform an initial import to create a new branch.")
+
+ takes_options = [to_opt, snapshot_opt, filename_opt, initial_opt]
+
+ def run(self, files_list, to=None, snapshot=None, filename=None,
+ initial=False):
from import_dsc import DscImporter, SnapshotImporter
if files_list is None:
files_list = []
@@ -443,18 +447,8 @@
for line in sources_file:
line.strip()
files_list.append(line)
- incremental = True
- inc_to = '.'
- if to is not None:
- inc_to = to
- try:
- tree = WorkingTree.open(inc_to)
- except NoWorkingTree:
- incremental = False
- except NotBranchError:
- incremental = False
if snapshot is None:
- if incremental:
+ if not initial:
if len(files_list) != 1:
raise BzrCommandError("You must give the location of exactly one "
"source package.")
@@ -468,13 +462,13 @@
"destination branch using the --to option.")
importer = DscImporter(files_list)
else:
- if incremental:
- raise BzrCommandError("You cannot use the --snapshot option with an "
- "existing branch")
+ if not initial:
+ raise BzrCommandError("You cannot use the --snapshot option without "
+ "the --initial option.")
if to is None:
to = snapshot
importer = SnapshotImporter(snapshot, other_sources=files_list)
- if not incremental:
+ if initial:
orig_target = os.path.join(to, '../tarballs')
importer.import_dsc(to, orig_target=orig_target)
else :
=== modified file 'debian/changelog'
--- a/debian/changelog 2007-10-23 21:25:20 +0000
+++ b/debian/changelog 2007-10-29 22:04:19 +0000
@@ -1,3 +1,10 @@
+bzr-builddeb (0.92) unstable; urgency=low
+
+ * Support incremental imports of normal mode packages from source packages
+ for uploads done outside the VCS.
+
+ -- James Westby <jw+debian at jameswestby.net> Mon, 29 Oct 2007 22:03:26 +0000
+
bzr-builddeb (0.91) unstable; urgency=low
[ Fr?d?ric Brin ]
=== modified file 'doc/user_manual/native.rst'
--- a/doc/user_manual/native.rst 2007-10-23 21:25:20 +0000
+++ b/doc/user_manual/native.rst 2007-10-29 22:04:19 +0000
@@ -81,7 +81,7 @@
::
- $ bzr import-dsc --to scruff *.dsc
+ $ bzr import-dsc --initial --to scruff *.dsc
which will create a branch named ``scruff``, which will have the history
populated with the information in the source packages. You can see this
@@ -94,7 +94,7 @@
``SFTP`` automatically. Just give the URIs to the files on the command line
instead of local paths. For instance::
- $ bzr import-dsc --to scruff \
+ $ bzr import-dsc --initial --to scruff \
http://ftp.debian.org/pool/main/s/scruff/scruff_0.1-1.dsc
As it is unwieldy to provide lots of URIs on the command line it is also
@@ -106,7 +106,7 @@
::
- $ bzr import-dsc --to scruff -F package-sources
+ $ bzr import-dsc --initial --to scruff -F package-sources
will import all of the ``.dsc`` files listed. You can provide both a file
and a list of packages on the command line if you like.
@@ -123,7 +123,7 @@
::
- $ bzr import-dsc --to scruff --snapshot scruff *.dsc
+ $ bzr import-dsc --initial --to scruff --snapshot scruff *.dsc
to have all those versions automatically imported. If you use the
``--snapshot`` option then it is possible to omit all of the source packages
=== modified file 'doc/user_manual/normal.rst'
--- a/doc/user_manual/normal.rst 2007-10-29 21:17:57 +0000
+++ b/doc/user_manual/normal.rst 2007-10-29 22:04:19 +0000
@@ -137,7 +137,7 @@
::
- $ bzr import-dsc --to scruff *.dsc
+ $ bzr import-dsc --initial --to scruff *.dsc
which will create a branch named ``scruff``, which will have the history
populated with the information in the source packages. You can see this
@@ -150,7 +150,7 @@
``SFTP`` automatically. Just give the URIs to the files on the command line
instead of local paths. For instance::
- $ bzr import-dsc --to scruff \
+ $ bzr import-dsc --initial --to scruff \
http://ftp.debian.org/pool/main/s/scruff/scruff_0.1-1.dsc
As it is unwieldy to provide lots of URIs on the command line it is also
@@ -162,7 +162,7 @@
::
- $ bzr import-dsc --to scruff -F package-sources
+ $ bzr import-dsc --initial --to scruff -F package-sources
will import all of the ``.dsc`` files listed. You can provide both a file
and a list of packages on the command line if you like.
@@ -179,7 +179,7 @@
::
- $ bzr import-dsc --to scruff --snapshot scruff *.dsc
+ $ bzr import-dsc --initial --to scruff --snapshot scruff *.dsc
to have all those versions automatically imported. If you use the
``--snapshot`` option then it is possible to omit all of the source packages
=== modified file 'tests/blackbox/test_import_dsc.py'
--- a/tests/blackbox/test_import_dsc.py 2007-10-29 21:17:57 +0000
+++ b/tests/blackbox/test_import_dsc.py 2007-10-29 22:04:19 +0000
@@ -76,7 +76,8 @@
def test_import_dsc(self):
self.make_real_source_package()
- self.run_bzr('import-dsc --to %s %s' % (self.package_name, self.dsc_name))
+ self.run_bzr('import-dsc --initial --to %s %s' % \
+ (self.package_name, self.dsc_name))
tree = WorkingTree.open(self.package_name)
tree.lock_read()
try:
@@ -89,20 +90,20 @@
def test_import_no_to(self):
self.make_real_source_package()
self.run_bzr_error(['You must specify the name of the destination branch '
- 'using the --to option.'], 'import-dsc %s' % self.dsc_name)
+ 'using the --to option.'], 'import-dsc --initial %s' % self.dsc_name)
def test_import_snapshot_incremental(self):
self.make_branch_and_tree('.')
self.make_real_source_package()
- self.run_bzr_error(['You cannot use the --snapshot option with an '
- 'existing branch'],
+ self.run_bzr_error(['You cannot use the --snapshot option without the '
+ '--initial option'],
'import-dsc --snapshot %s %s' % (self.package_name, self.dsc_name))
def test_import_snapshot_incremental_with_to(self):
self.make_branch_and_tree('target')
self.make_real_source_package()
- self.run_bzr_error(['You cannot use the --snapshot option with an '
- 'existing branch'],
+ self.run_bzr_error(['You cannot use the --snapshot option without the '
+ '--initial option'],
'import-dsc --snapshot %s --to target %s' % \
(self.package_name, self.dsc_name))
More information about the Pkg-bazaar-commits
mailing list