Skip to contentSkip to conversation

revised patch for importing series from tarball

PATCH In review Clark Williams 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 revised patch for importing series from tarball

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Catalin,

Attached is my revised patch (v2 I believe) for importing a series directly from a tarball. I looked at the critique offered by Karl (pretty hard actually), but I decided in the end to keep extracting the tarball to a temp directory. It's possible that it would be desirable to extract members directly from a tarball (although as far as I can tell, you still have to extract them to a file) but I didn't judge the churn in imprt.py to be worth it for now. This version is pretty simple, in that you just detect that the input to to import_series is a tarball, call import_tarfile, then return.

I added a simple test to the test harness for import as well.

Oh and I added '*.elc' to the .gitignore file. May not be that many folks using emacs with stgit, but hey, I am! :)

Clark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkj7h4QACgkQqA4JVb61b9dq4ACbB9tl0FbHq5igNIPIbzALhyLf Aw8An3weTNye7yzQ/wU2Hyt1agzCzTtC
=7WjV
-----END PGP SIGNATURE-----

patch to allow importing a series from a tar archive

From: Clark Williams <[email protected]>

---
 .gitignore                                      |    1 
 stgit/commands/imprt.py                         |   47 ++++++++++++++++++++++-
 t/t1800-import.sh                               |   12 ++++++
 t/t1800-import/patches/attribution.patch        |   21 ++++++++++
 t/t1800-import/patches/delete-extra-lines.patch |   22 +++++++++++
 t/t1800-import/patches/fifth-stanza.patch       |   22 +++++++++++
 t/t1800-import/patches/first-stanza.patch       |   18 +++++++++
 t/t1800-import/patches/fourth-stanza.patch      |   22 +++++++++++
 t/t1800-import/patches/second-stanza.patch      |   22 +++++++++++
 t/t1800-import/patches/series                   |   10 +++++
 t/t1800-import/patches/seventh-stanza.patch     |   24 ++++++++++++
 t/t1800-import/patches/sixth-stanza.patch       |   22 +++++++++++
 t/t1800-import/patches/third-stanza.patch       |   22 +++++++++++
 13 files changed, 263 insertions(+), 2 deletions(-)
 create mode 100644 t/t1800-import/patches/attribution.patch
 create mode 100644 t/t1800-import/patches/delete-extra-lines.patch
 create mode 100644 t/t1800-import/patches/fifth-stanza.patch
 create mode 100644 t/t1800-import/patches/first-stanza.patch
 create mode 100644 t/t1800-import/patches/fourth-stanza.patch
 create mode 100644 t/t1800-import/patches/second-stanza.patch
 create mode 100644 t/t1800-import/patches/series
 create mode 100644 t/t1800-import/patches/seventh-stanza.patch
 create mode 100644 t/t1800-import/patches/sixth-stanza.patch
 create mode 100644 t/t1800-import/patches/third-stanza.patch
.gitignore +1 -0
index 91dbad2..f0e5d30 100644
@@ -6,3 +6,4 @@ patches-*
 release.sh
 setup.cfg.rpm
 snapshot.sh
+*.elc
stgit/commands/imprt.py +45 -2

77 lines not on this page · raw message

t/t1800-import.sh +12 -0
index 1352743..5a3384f 100755
@@ -122,4 +122,16 @@ test_expect_success \
     stg delete ..
     '
 
+test_expect_success \
+    'apply a series from a tarball' \
+    '
+    rm -f jabberwocky.txt && touch jabberwocky.txt &&
+    git add jabberwocky.txt && git commit -m "empty file" jabberwocky.txt &&
+    (cd ../t1800-import; tar -cjf jabberwocky.tar.bz2 patches) &&
+    stg import --series ../t1800-import/jabberwocky.tar.bz2
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "tree 2c33937252a21f1550c0bf21f1de534b68f69635") = 1 ] &&
+    rm ../t1800-import/jabberwocky.tar.bz2
+    '
+    
 test_done
t/t1800-import/patches/attribution.patch new file +21 -0
new file mode 100644
index 0000000..2b7c8f9
@@ -0,0 +1,21 @@
+attribution
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 066d2e8..a9dd1f3 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -32,3 +32,7 @@ O frabjous day! Callooh! Callay!'
+   Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
+   And the mome raths outgrabe.
++
++	JABBERWOCKY
++	Lewis Carroll
++	(from Through the Looking-Glass and What Alice Found There, 1872) 
t/t1800-import/patches/delete-extra-lines.patch new file +22 -0
new file mode 100644
index 0000000..e5b7a65
@@ -0,0 +1,22 @@
+delete extra lines
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    2 --
+ 1 files changed, 0 insertions(+), 2 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 98cb716..066d2e8 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -28,8 +28,6 @@ He left it dead, and with its head
+ O frabjous day! Callooh! Callay!'
+   He chortled in his joy.
+ 
+-
+-
+ `Twas brillig, and the slithy toves
+   Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
t/t1800-import/patches/fifth-stanza.patch new file +22 -0
new file mode 100644
index 0000000..4f0e77c
@@ -0,0 +1,22 @@
+fifth stanza
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index b1c2ad3..f1416dc 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -17,3 +17,8 @@ And, as in uffish thought he stood,
+   The Jabberwock, with eyes of flame,
+ Came whiffling through the tulgey wood,
+   And burbled as it came!
++
++One, two! One, two! And through and through
++  The vorpal blade went snicker-snack!
++He left it dead, and with its head
++  He went galumphing back.
t/t1800-import/patches/first-stanza.patch new file +18 -0
new file mode 100644
index 0000000..ee7818f
@@ -0,0 +1,18 @@
+first stanza
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index e69de29..fba24dc 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -0,0 +1,4 @@
++`Twas brillig, and the slithy toves
++  Did gyre and gimble in the wabe:
++All mimsy were the borogoves,
++  And the mome raths outgrabe.
t/t1800-import/patches/fourth-stanza.patch new file +22 -0
new file mode 100644
index 0000000..eb2f8f2
@@ -0,0 +1,22 @@
+fourth stanza
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 6405f36..b1c2ad3 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -12,3 +12,8 @@ He took his vorpal sword in hand:
+   Long time the manxome foe he sought --
+ So rested he by the Tumtum tree,
+   And stood awhile in thought.
++
++And, as in uffish thought he stood,
++  The Jabberwock, with eyes of flame,
++Came whiffling through the tulgey wood,
++  And burbled as it came!
t/t1800-import/patches/second-stanza.patch new file +22 -0
new file mode 100644
index 0000000..bec1622
@@ -0,0 +1,22 @@
+second stanza
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index fba24dc..9ed0b49 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -2,3 +2,8 @@
+   Did gyre and gimble in the wabe:
+ All mimsy were the borogoves,
+   And the mome raths outgrabe.
++
++"Beware the Jabberwock, my son!
++  The jaws that bite, the claws that catch!
++Beware the Jubjub bird, and shun
++  The frumious Bandersnatch!"
t/t1800-import/patches/series new file +10 -0
new file mode 100644
index 0000000..5945c98
@@ -0,0 +1,10 @@
+# This series applies on GIT commit 6a8b6f6e2ecbcab26de7656b66b7f30eeba1ee96
+first-stanza.patch
+second-stanza.patch
+third-stanza.patch
+fourth-stanza.patch
+fifth-stanza.patch
+sixth-stanza.patch
+seventh-stanza.patch
+delete-extra-lines.patch
+attribution.patch
t/t1800-import/patches/seventh-stanza.patch new file +24 -0
new file mode 100644
index 0000000..555c200
@@ -0,0 +1,24 @@
+seventh stanza
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    7 +++++++
+ 1 files changed, 7 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index bf732f5..98cb716 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -27,3 +27,10 @@ He left it dead, and with its head
+   Come to my arms, my beamish boy!
+ O frabjous day! Callooh! Callay!'
+   He chortled in his joy.
++
++
++
++`Twas brillig, and the slithy toves
++  Did gyre and gimble in the wabe;
++All mimsy were the borogoves,
++  And the mome raths outgrabe.
t/t1800-import/patches/sixth-stanza.patch new file +22 -0
new file mode 100644
index 0000000..2349b7e
@@ -0,0 +1,22 @@
+sixth stanza
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index f1416dc..bf732f5 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -22,3 +22,8 @@ One, two! One, two! And through and through
+   The vorpal blade went snicker-snack!
+ He left it dead, and with its head
+   He went galumphing back.
++
++"And, has thou slain the Jabberwock?
++  Come to my arms, my beamish boy!
++O frabjous day! Callooh! Callay!'
++  He chortled in his joy.
t/t1800-import/patches/third-stanza.patch new file +22 -0
new file mode 100644
index 0000000..d942353
@@ -0,0 +1,22 @@
+third stanza
+
+From: Clark Williams <[email protected]>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 9ed0b49..6405f36 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -7,3 +7,8 @@ All mimsy were the borogoves,
+   The jaws that bite, the claws that catch!
+ Beware the Jubjub bird, and shun
+   The frumious Bandersnatch!"
++
++He took his vorpal sword in hand:
++  Long time the manxome foe he sought --
++So rested he by the Tumtum tree,
++  And stood awhile in thought.
#1 lore raw
Quoted 1 line · Clark Williams

I added a simple test to the test harness for import as well.

Great!

Quoted 2 lines

Oh and I added '*.elc' to the .gitignore file. May not be that many folks using emacs with stgit, but hey, I am! :)

Me too (but I have *.elc in my personal ignore file, so I never saw it). However, this is an unrelated change, and we don't need to ignore .elc files at the top level, only in contrib. I've taken the liberty of splitting this out to a separate commit and forging your signature on it -- let me know if that's OK and I'll push it out.

Quoted 1 line

patch to allow importing a series from a tar archive

I turned this into a complete sentence, and removed "patch" since it's entirely redundant.

.gitignore patches-* · line 9

Quoted 7 lines
.gitignore +1 -0
@@ -6,3 +6,4 @@ patches-*
 release.sh
 setup.cfg.rpm
 snapshot.sh
+*.elc

As I said, I put this in a separate patch, and put that ignore pattern in contrib.gitignore instead.

.gitignore

Quoted 4 lines
            make_option('--commemail',
.gitignore +1 -1
-                       help = 'use COMMEMAIL as the committer e-mail')
+                       help = 'use COMMEMAIL as the committer e-mail'),
            ] + make_sign_options()

This is just a noise change _and_ didn't apply, so I dropped it.

Signature · 2 lines
Karl Hasselström, [email protected]
      www.treskal.com/kalle
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 6 lines · On Fri, 24 Oct 2008 03:17:08 +0200 Karl Hasselström <[email protected]> wrote:
Quoted 1 line · Clark Williams

I added a simple test to the test harness for import as well.

Great!

Quoted 9 lines
Quoted 2 lines

Oh and I added '*.elc' to the .gitignore file. May not be that many folks using emacs with stgit, but hey, I am! :)

Me too (but I have *.elc in my personal ignore file, so I never saw it). However, this is an unrelated change, and we don't need to ignore .elc files at the top level, only in contrib. I've taken the liberty of splitting this out to a separate commit and forging your signature on it -- let me know if that's OK and I'll push it out.

Yes, that's fine.

Quoted 5 lines
Quoted 1 line

patch to allow importing a series from a tar archive

I turned this into a complete sentence, and removed "patch" since it's entirely redundant.

Quoted 11 lines

.gitignore patches-* · line 9

Quoted 7 lines
.gitignore +1 -0
@@ -6,3 +6,4 @@ patches-*
 release.sh
 setup.cfg.rpm
 snapshot.sh
+*.elc

As I said, I put this in a separate patch, and put that ignore pattern in contrib.gitignore instead.

Thanks

Quoted 7 lines

.gitignore

Quoted 4 lines
            make_option('--commemail',
.gitignore +1 -1
-                       help = 'use COMMEMAIL as the committer e-mail')
+                       help = 'use COMMEMAIL as the committer e-mail'),
            ] + make_sign_options()

This is just a noise change _and_ didn't apply, so I dropped it.

Agreed.

Thanks for the update.

Clark

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkkBOJ0ACgkQqA4JVb61b9e6SgCeOZ0YrB/uSrvSqgLkxnLjiQp2 AWwAoKIeIQUOWEghEOWBgODnTojA2o5q
=B9dz
-----END PGP SIGNATURE-----