[Pkg-bazaar-commits] ./bzr-builddeb/trunk r203: Also exclude RCS , v files when importing.
James Westby
jw+debian at jameswestby.net
Thu May 15 13:29:36 UTC 2008
------------------------------------------------------------
revno: 203
committer: James Westby <jw+debian at jameswestby.net>
branch nick: trunk
timestamp: Fri 2008-01-25 13:32:52 +0000
message:
Also exclude RCS ,v files when importing.
For one thing they are version control meta-data, and so we don't want it.
However they also make patch do silly, silly things.
modified:
import_dsc.py
tests/test_import_dsc.py
-------------- next part --------------
=== modified file 'import_dsc.py'
--- a/import_dsc.py 2008-01-25 12:22:42 +0000
+++ b/import_dsc.py 2008-01-25 13:32:52 +0000
@@ -69,6 +69,7 @@
underscore_x = ['-x'] * len(exclude)
ignore_arguments = []
map(ignore_arguments.extend, zip(underscore_x, exclude))
+ignore_arguments = ignore_arguments + ['-x', '*,v']
def import_tar(tree, tar_input, file_ids_from=None):
"""Replace the contents of a working directory with tarfile contents.
@@ -92,6 +93,8 @@
for part in parts:
if part in files_to_ignore:
return True
+ if part.endswith(',v'):
+ return True
def import_archive(tree, archive_file, file_ids_from=None):
=== modified file 'tests/test_import_dsc.py'
--- a/tests/test_import_dsc.py 2008-01-25 12:22:42 +0000
+++ b/tests/test_import_dsc.py 2008-01-25 13:32:52 +0000
@@ -18,6 +18,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
+import gzip
import os
import shutil
import tarfile
@@ -1068,6 +1069,50 @@
DscImporter([self.native_dsc_1]).import_dsc(self.target)
self.failUnlessExists(self.target)
+ def test_import_with_rcs(self):
+ write_to_file('README', 'hello\n')
+ write_to_file('README,v', 'bye bye\n')
+ tar = tarfile.open(self.native_1, 'w:gz')
+ try:
+ tar.add('README')
+ tar.add('README,v')
+ finally:
+ tar.close()
+ os.unlink('README')
+ os.unlink('README,v')
+ self.make_dsc(self.native_dsc_1, '0.1', self.native_1)
+ DscImporter([self.native_dsc_1]).import_dsc(self.target)
+ self.failUnlessExists(self.target)
+ self.failIfExists(os.path.join(self.target, 'README,v'))
+
+ def test_patch_with_rcs(self):
+ self.make_orig_1()
+ diffdir = 'package-0.1'
+ shutil.copytree(self.basedir, diffdir)
+ f = gzip.open(self.diff_1, 'w')
+ try:
+ f.write(
+"""diff -Nru package/file,v package-0.2/file,v
+--- package/file,v 1970-01-01 01:00:00.000000000 +0100
++++ package-0.2/file,v 2008-01-25 12:48:26.823475582 +0000
+@@ -0,0 +1 @@
++with a passion
+\ No newline at end of file
+diff -Nru package/file package-0.2/file
+--- package/file 1970-01-01 01:00:00.000000000 +0100
++++ package-0.2/file 2008-01-25 12:48:26.823475582 +0000
+@@ -0,0 +1 @@
++with a passion
+\ No newline at end of file
+""")
+ finally:
+ f.close()
+ self.make_dsc(self.dsc_1, '0.1-1', self.orig_1, [self.diff_1])
+ DscImporter([self.dsc_1]).import_dsc(self.target)
+ self.failUnlessExists(self.target)
+ self.failIfExists(os.path.join(self.target, 'changelog'))
+ self.failIfExists(os.path.join(self.target, 'changelog,v'))
+
def test_import_extra_slash(self):
tar = tarfile.open(self.native_1, 'w:gz')
try:
More information about the Pkg-bazaar-commits
mailing list