git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: stgit 0.13 import mbox problems

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Aug 23, 2007, 10:19 UTC
Message-ID
<b0943d9e0708230319m3242f4a7yb4db1505f0d2e3@mail.gmail.com>
In-Reply-To
<20070823092254.GA5976@kroah.com>
On 23/08/07, Greg KH <greg@kroah.com> wrote:
> I wanted to see if I could start using stgit instead of quilt, so I
> tried to import my current set of kernel patches.
>
> After giving up on the "import a series" option,
Why?
Show 11 quoted lines
> I just created a mbox
> of all of them using quilt and tried to import that.  Unfortunately that
> didn't work either:
>         $ stg import -M ~/linux/patches/mbox
>         Checking for changes in the working directory ... done
>         Importing patch "add-my-version-to-the-kernel" ... done
>         Importing patch "stupid-patch-for-my-laptop-whi" ... done
>         Importing patch "gregs-test-driver-core-sysfs-s" ... done
>         Importing patch "detect-atomic-counter-underflo" ... done
>         Warning: Message does not contain any diff
>         stg import: No diff found inside the patch

Maybe I should just leave the warning and let it continue. The reason I added it was that "git-apply --index" fails if there is no diff.

In the meantime, you can try the attached patch for StGIT.

Another hint - quilt can apply patches with fuzz but GIT doesn't allow this by default. If a patch fails, the diff is dumped to the .stgit-failed.patch file so that you can apply it manually (with patch or git-apply) and run 'stg refresh' afterwards.

After an import failure, you can continue importing from the next patch using the 'stg import --ignore' option.

Show 6 quoted lines
> I'm using the .13 version if that matters.
>
> The mbox contains 177 kernel patches against Linus's current tree
> (2.6.23-rc3-git5), and is available at:
>         http://www.kernel.org/pub/linux/kernel/people/gregkh/misc/gregkh-stgit-import-mbox.gz
> if anyone wants to test it out and see what I was doing wrong.
I'll give it a try.

One thing you'll notice is the speed difference as stgit has to generate a git commit during a push operation.

> Oh, I do have some suggestions as to the naming of the patch from a mail
> file, as limiting this to a small number of characters like stgit
> currently does will not work out for a lot of my patches, but I'll wait
> until I can actually import the thing before I look into that :)

We had the full name in the past but the algorithm cause problems with patches (not e-mails) that didn't have a subject line. It's probably better to have a config option rather than hard-coded 30 characters. Note that 'stg series -d' will display the full subject line.

If you don't give up before importing the files :-), please let us know the user experience, especially related to speed as compared to quilt.

Karl, maybe it's worth trying this series with your DAG patches as well.
Regards.
-- 
Catalin


Allow 'import' to apply empty patches

From: Catalin Marinas <catalin.marinas@gmail.com>

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---

 stgit/commands/imprt.py |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
index f972b89..98fe708 100644
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -201,8 +201,6 @@ def __parse_mail(msg):
     rem_descr, diff = __split_descr_diff(msg_text)
     if rem_descr:
         descr += '\n\n' + rem_descr
-    if not diff:
-        out.warn('Message does not contain any diff')
 
     # parse the description for author information
     descr, descr_authname, descr_authemail, descr_authdate = \
@@ -250,9 +248,6 @@ def __create_patch(filename, message, author_name, author_email,
         # fix possible invalid characters in the patch name
         patch = re.sub('[^\w.]+', '-', patch).strip('-')
 
-    if not diff:
-        raise CmdException, 'No diff found inside the patch'
-
     if options.ignore and patch in crt_series.get_applied():
         out.info('Ignoring already applied patch "%s"' % patch)
         return
@@ -288,14 +283,17 @@ def __create_patch(filename, message, author_name, author_email,
                          committer_name = committer_name,
                          committer_email = committer_email)
 
-    out.start('Importing patch "%s"' % patch)
-    if options.base:
-        git.apply_patch(diff = diff, base = git_id(options.base))
+    if not diff:
+        out.warn('No diff found, creating empty patch')
     else:
-        git.apply_patch(diff = diff)
-    crt_series.refresh_patch(edit = options.edit,
-                             show_patch = options.showpatch)
-    out.done()
+        out.start('Importing patch "%s"' % patch)
+        if options.base:
+            git.apply_patch(diff = diff, base = git_id(options.base))
+        else:
+            git.apply_patch(diff = diff)
+        crt_series.refresh_patch(edit = options.edit,
+                                 show_patch = options.showpatch)
+        out.done()
 
 def __import_file(filename, options, patch = None):
     """Import a patch from a file or standard input
Previous: Greg KHNext: Catalin Marinas
Message 2 of 14 in “stgit 0.13 import mbox problems”
  1. Greg KHAug 23, 2007
  2. Catalin MarinasAug 23, 2007
  3. Catalin MarinasAug 23, 2007
  4. Greg KHAug 23, 2007
  5. J. Bruce FieldsAug 23, 2007
  6. Greg KHAug 23, 2007
  7. Catalin MarinasAug 23, 2007
  8. Josef SipekAug 23, 2007
  9. Greg KHAug 23, 2007
  10. Josef SipekAug 23, 2007
  11. Catalin MarinasAug 23, 2007
  12. Josef SipekAug 23, 2007
  13. Catalin MarinasAug 23, 2007
  14. Josef SipekAug 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.