Re: [PATCH] Add another fast-import example, this time for .zip files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, 30 Jun 2008, Johannes Schindelin wrote:

> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> ---
> 
> 	I needed that today.

... and I needed that on top, which I forgot to commit, and therefore 
never sent in my first mail on this subject:

-- snipsnap --
diff --git a/contrib/fast-import/import-zip.py b/contrib/fast-import/import-zips.py
similarity index 85%
rename from contrib/fast-import/import-zip.py
rename to contrib/fast-import/import-zips.py
index 4200a66..fcf5823 100755
--- a/contrib/fast-import/import-zip.py
+++ b/contrib/fast-import/import-zips.py
@@ -40,6 +40,11 @@ for zipfile in argv[1:]:
 
 		if commit_time < info.date_time:
 			commit_time = info.date_time
+		if common_prefix == None:
+			common_prefix = name[:name.rfind('/') + 1]
+		else:
+			while not name.startswith(common_prefix):
+				common_prefix = name[:name.rfind('/') + 1]
 
 		mark[name] = ':' + str(next_mark)
 		next_mark += 1
@@ -56,7 +61,8 @@ for zipfile in argv[1:]:
 		'', 'deleteall'))
 
 	for name in mark.keys():
-		fast_import.write('M 100644 ' + mark[name] + ' ' + name + "\n")
+		fast_import.write('M 100644 ' + mark[name] + ' ' +
+			name[len(common_prefix):] + "\n")
 
 	printlines(('',  'tag ' + path.basename(zipfile), \
 		'from ' + branch_ref, 'tagger ' + committer, \
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux