backports: keep headers on patch refresh
cover backports: keep headers on patch refresh
From: "Luis R. Rodriguez" <[email protected]>
This changeset updates the backports project to enable keeping headers around upon patch refresh. We now use a Python library for managing patches, update that library to the the latest from svn trunk, make a small change to it and then modify our gentree.py to take advantage of it.
Anatoly, feel free to incorporate the patch.py change to your respective upstream if you see it fit.
Luis R. Rodriguez (3):
backports: update patch Python library lib/patch.py: add top header parsing support gentree.py: keep patch headers for patch refresh
gentree.py | 4 +++- lib/patch.py | 45 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/3 backports: update patch Python library
From: "Luis R. Rodriguez" <[email protected]>
This updates the backports project up to synch with the latest patch.py from svn trunk.
--- lib/patch.py | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-)
lib/patch.py +34 -9
@@ -9,12 +9,12 @@ Project home: http://code.google.com/p/python-patch/ - $Id: patch.py 181 2012-11-23 16:03:05Z techtonik $ - $HeadURL: https://python-patch.googlecode.com/svn/trunk/patch.py $ + $Id$ + $HeadURL$ """ __author__ = "anatoly techtonik <[email protected]>" -__version__ = "1.12.11" +__version__ = "1.12.12dev" import copy import logging
@@ -163,6 +163,7 @@ class Hunk(object): self.starttgt=None self.linestgt=None self.invalid=False + self.desc='' self.text=[] # def apply(self, estream):
@@ -273,7 +274,7 @@ class PatchSet(object): hunkparsed = False # state after successfully parsed hunk # regexp to match start of hunk, used groups - 1,3,4,6 - re_hunk_start = re.compile("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?") + re_hunk_start = re.compile("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@") self.errors = 0 # temp buffers for header and filenames info
@@ -478,7 +479,7 @@ class PatchSet(object): continue if hunkhead: - match = re.match("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?", line) + match = re.match("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@(.*)", line) if not match: if not p.hunks: warning("skipping invalid patch with no hunks for file %s" % p.source)
@@ -502,6 +503,7 @@ class PatchSet(object): hunk.linestgt = 1 if match.group(6): hunk.linestgt = int(match.group(6)) hunk.invalid = False + hunk.desc = match.group(7)[1:].rstrip() hunk.text = [] hunkactual["linessrc"] = hunkactual["linestgt"] = 0
@@ -627,6 +629,20 @@ class PatchSet(object): return None """ for i,p in enumerate(self.items): + if p.type in (HG, GIT): + # TODO: figure out how to deal with /dev/null entries + debug("stripping a/ and b/ prefixes") + if p.source != '/dev/null': + if not p.source.startswith("a/"): + warning("invalid source filename") + else: + p.source = p.source[2:] + if p.target != '/dev/null': + if not p.target.startswith("b/"): + warning("invalid target filename") + else: + p.target = p.target[2:] + p.source = xnormpath(p.source) p.target = xnormpath(p.target)
@@ -712,10 +728,14 @@ class PatchSet(object): return output - def apply(self, strip=0): - """ apply parsed patch + def apply(self, strip=0, root=None): + """ Apply parsed patch, optionally stripping leading components + from file paths. `root` parameter specifies working dir. return True on success """ + if root: + prevdir = os.getcwd() + os.chdir(root) total = len(self.items) errors = 0
@@ -742,7 +762,7 @@ class PatchSet(object): debug("stripping %s leading component from '%s'" % (strip, f2patch)) f2patch = pathstrip(f2patch, strip) if not exists(f2patch): - warning("source/target file does not exist\n--- %s\n+++ %s" % (p.source, f2patch)) + warning("source/target file does not exist:\n --- %s\n +++ %s" % (p.source, f2patch)) errors += 1 continue if not isfile(f2patch):
@@ -839,6 +859,9 @@ class PatchSet(object): # todo: proper rejects shutil.move(backupname, filename) + if root: + os.chdir(prevdir) + # todo: check for premature eof return (errors == 0)
@@ -989,6 +1012,8 @@ if __name__ == "__main__": opt.add_option("--debug", action="store_true", dest="debugmode", help="debug mode") opt.add_option("--diffstat", action="store_true", dest="diffstat", help="print diffstat and exit") + opt.add_option("-d", "--directory", metavar='DIR', + help="specify root directory for applying patch") opt.add_option("-p", "--strip", type="int", metavar='N', default=0, help="strip N path components from filenames") (options, args) = opt.parse_args()
@@ -1031,7 +1056,7 @@ if __name__ == "__main__": sys.exit(0) #pprint(patch) - patch.apply(options.strip) or sys.exit(-1) + patch.apply(options.strip, root=options.directory) or sys.exit(-1) # todo: document and test line ends handling logic - patch.py detects proper line-endings # for inserted hunks and issues a warning if patched file has incosistent line ends
Signature · 1 line
1.7.10.4
Re: [PATCH 1/3] backports: update patch Python library
Quoted 8 lines · Luis R. Rodriguez
lib/patch.py +4
-0@@ -627,6 +629,20 @@ class PatchSet(object): return None """ for i,p in enumerate(self.items): + if p.type in (HG, GIT): + # TODO: figure out how to deal with /dev/null entries + debug("stripping a/ and b/ prefixes") + if p.source != '/dev/null':
lib/patch.py class PatchSet(object): · line 645
Quoted 10 lines
lib/patch.py +10
-0+ if not p.source.startswith("a/"): + warning("invalid source filename") + else: + p.source = p.source[2:] + if p.target != '/dev/null': + if not p.target.startswith("b/"): + warning("invalid target filename") + else: + p.target = p.target[2:] +
Unfortunately, adding this back is problematic.
We assume that all patches need one level stripped, but if a patch is a git patch (as indicated by having the "diff" and/or (?) "index" lines), then the patch library will already strip a level. That basically assumes that users use "-p0" on 'plain' patches, which isn't the case, we always use -p1.
IOW, this will break dropping git patches (e.g. git diff/show/format-patch) into the patches directory.
Anatoly, would you be interested in maybe having an option to disable this stripping? If yes, I can do that, otherwise I'm just going to edit it out of our copy of your library again :-)
johannes
Re: [PATCH 1/3] backports: update patch Python library
Quoted 14 lines · Johannes Berg
Quoted 12 lines · Luis R. Rodriguez
lib/patch.py +8
-0@@ -627,6 +629,20 @@ class PatchSet(object): return None """ for i,p in enumerate(self.items): + if p.type in (HG, GIT): + # TODO: figure out how to deal with /dev/null entries + debug("stripping a/ and b/ prefixes") + if p.source != '/dev/null': + if not p.source.startswith("a/"): + warning("invalid source filename") + else: + p.source = p.source[2:]
Quoted 9 lines
lib/patch.py class PatchSet(object): · line 645
Quoted 6 lines
lib/patch.py +6
-0+ if p.target != '/dev/null': + if not p.target.startswith("b/"): + warning("invalid target filename") + else: + p.target = p.target[2:] +Unfortunately, adding this back is problematic.
Sorry for a long delay. I finally lost my job, so now I can have some continuous
time piece to concentrate on python-patch.
Quoted 9 lines
We assume that all patches need one level stripped, but if a patch is a git patch (as indicated by having the "diff" and/or (?) "index" lines), then the patch library will already strip a level. That basically assumes that users use "-p0" on 'plain' patches, which isn't the case, we always use -p1.
IOW, this will break dropping git patches (e.g. git diff/show/format-patch) into the patches directory.
patch.py is smart enough to strip only a/ and b/ prefixes, and do this automatically when it is needed.
How do you use patch.py?
Why do you have to use -p1?
Anatoly, would you be interested in maybe having an option to disable
Quoted 3 lines
this stripping? If yes, I can do that, otherwise I'm just going to edit it out of our copy of your library again :-)
Thanks to Google Code editor with no HG or GIT watermark I now also implemented a/ and b/ stripping logic in apply function - see here:
http://code.google.com/p/python-patch/source/browse/trunk/patch.py?spec=svn229&r=229#746
It will be in first 1.14.x release.
Patch.source and .target are always filenames by design regardless of patch type (that's not true for Google Code patches, but am reluctant to make quirks mode parser as a workaround for their bugs). Preserving names as original means that users have to care about patch type and strip those prefixes themselves for HG and GIT, which is usability fail. There is no data loss in current implementation. If you need prefixes, it is possible to restore them by patch type.
Signature · 1 line
anatoly t.
Re: [PATCH 1/3] backports: update patch Python library
In reply to Johannes BergResending as a plain text to calm down mailer-daemon.
Quoted 15 lines · Johannes Berg
Quoted 12 lines · Luis R. Rodriguez
lib/patch.py +8
-0@@ -627,6 +629,20 @@ class PatchSet(object): return None """ for i,p in enumerate(self.items): + if p.type in (HG, GIT): + # TODO: figure out how to deal with /dev/null entries + debug("stripping a/ and b/ prefixes") + if p.source != '/dev/null': + if not p.source.startswith("a/"): + warning("invalid source filename") + else: + p.source = p.source[2:]
Quoted 8 lines
lib/patch.py class PatchSet(object): · line 645
Quoted 6 lines
lib/patch.py +6
-0+ if p.target != '/dev/null': + if not p.target.startswith("b/"): + warning("invalid target filename") + else: + p.target = p.target[2:] +Unfortunately, adding this back is problematic.
Sorry for a long delay. I finally lost my job, so now I can have some continuous time piece to concentrate on python-patch.
Quoted 9 lines
We assume that all patches need one level stripped, but if a patch is a git patch (as indicated by having the "diff" and/or (?) "index" lines), then the patch library will already strip a level. That basically assumes that users use "-p0" on 'plain' patches, which isn't the case, we always use -p1.
IOW, this will break dropping git patches (e.g. git diff/show/format-patch) into the patches directory.
patch.py is smart enough to strip only a/ and b/ prefixes, and do this automatically when it is needed.
How do you use patch.py?
Why do you have to use -p1?
Quoted 3 lines
Anatoly, would you be interested in maybe having an option to disable this stripping? If yes, I can do that, otherwise I'm just going to edit it out of our copy of your library again :-)
Thanks to Google Code editor with no HG or GIT watermark I now also implemented a/ and b/ stripping logic in apply function - see here:
http://code.google.com/p/python-patch/source/browse/trunk/patch.py?spec=svn229&r=229#746
It will be in first 1.14.x release.
Patch.source and .target are always filenames by design regardless of patch type (that's not true for Google Code patches, but am reluctant to make quirks mode parser as a workaround for their bugs). Preserving names as original means that users have to care about patch type and strip those prefixes themselves for HG and GIT, which is usability fail. There is no data loss in current implementation. If you need prefixes, it is possible to restore them by patch type.
Signature · 1 line
anatoly t.
Re: [PATCH 1/3] backports: update patch Python library
Quoted 2 lines · anatoly techtonik
Sorry for a long delay. I finally lost my job, so now I can have some continuous time piece to concentrate on python-patch.
Oops, sorry to hear that. You make it sound almost positive though.
Quoted 11 lines
Quoted 8 lines
We assume that all patches need one level stripped, but if a patch is a git patch (as indicated by having the "diff" and/or (?) "index" lines), then the patch library will already strip a level. That basically assumes that users use "-p0" on 'plain' patches, which isn't the case, we always use -p1.
IOW, this will break dropping git patches (e.g. git diff/show/format-patch) into the patches directory.
patch.pyis smart enough to strip only a/ and b/ prefixes, and do this automatically when it is needed.
Well, yes, but it doesn't auto-detect other prefixes. So if I diff something manually, then the prefixes aren't removed. As a result, I must generate the patch using git if I want it to work right, or must go against the -p1 convention when generating it manually. Both of those are cumbersome and hard to remember.
IOW, you're assuming that a 'real patch' has no prefix, and a 'git patch' has useless a/ and b/ prefixes. But that relies on a certain convention about a 'real patch' which isn't true in the Linux community.
Quoted 1 line
How do you use
patch.py?
We use it to apply patches within the backport project, those patches are stored in the project and applied against upstream Linux code.
Quoted 1 line
Why do you have to use -p1?
See above.
Quoted 8 lines
Quoted 3 lines
Anatoly, would you be interested in maybe having an option to disable this stripping? If yes, I can do that, otherwise I'm just going to edit it out of our copy of your library again :-)
Thanks to Google Code editor with no HG or GIT watermark I now also implemented a/ and b/ stripping logic in apply function - see here:
http://code.google.com/p/python-patch/source/browse/trunk/patch.py?spec=svn229&r=229#746
It will be in first 1.14.x release.
Again, you're assuming that the 'canonical patch' should have no prefixes. This is simply a matter of convention (whether -p0 or -p1 is preferred by the project when applying a patch), and that convention happens to be -p1 for many projects. You're assuming -p0.
Anyway, since the current version of patch.py does what we need, there's little incentive for us to update/change things. If you consider a 'canonical patch' to be -p0, we'll just keep our changed copy :)
johannes
Re: [PATCH 1/3] backports: update patch Python library
Quoted 6 lines · Johannes Berg
Quoted 2 lines · anatoly techtonik
Sorry for a long delay. I finally lost my job, so now I can have some continuous time piece to concentrate on python-patch.
Oops, sorry to hear that. You make it sound almost positive though.
Yes. It is too hard to cope with pressure in software development even though I had rather relaxing terms in the industry. Must be a psychological problem - something around OCD/ADHD, but that doesn't matter.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
We assume that all patches need one level stripped, but if a patch is a git patch (as indicated by having the "diff" and/or (?) "index" lines), then the patch library will already strip a level. That basically assumes that users use "-p0" on 'plain' patches, which isn't the case, we always use -p1.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
IOW, this will break dropping git patches (e.g. git diff/show/format-patch) into the patches directory.
patch.pyis smart enough to strip only a/ and b/ prefixes, and do this automatically when it is needed.Well, yes, but it doesn't auto-detect other prefixes. So if I diff something manually, then the prefixes aren't removed.
There are no other prefixes. Everything else are real directories that exist when you create the patch. Isn't it?
Quoted 4 lines
As a result, I
must generate the patch using git if I want it to work right, or must go against the -p1 convention when generating it manually. Both of those are cumbersome and hard to remember.
Usually you need to rename old directory to something like:
Quoted 1 line
myapp.old
and then run 'diff -u3 myapp.old myapp'
No prefixes are added, and patch.py is smart enough to detect that there is no myapp.old and apply patch to the myapp/ directory (well, actually you need to make sure that myapp.old does not exist for patch.py to find myapp/).
Quoted 3 lines
IOW, you're assuming that a 'real patch' has no prefix, and a 'git patch' has useless a/ and b/ prefixes. But that relies on a certain convention about a 'real patch' which isn't true in the Linux community.
Yes, I want to know about those prefixes in Linux community, because I developed this tool on Windows and test database doesn't have any samples.
Quoted 4 lines
Quoted 1 line
How do you use
patch.py?We use it to apply patches within the backport project, those patches are stored in the project and applied against upstream Linux code.
Yes. I've seen that. =)
https://code.google.com/p/python-patch/wiki/Adoptions
I more interested in complete like session recorded session, like standing behind the shoulder and watching, so that I can think on how to make patch.py usage more natural, rather than trying to instruct people how to use. But that's ideal case. I think that an exemplary shell session where the annoyance benefits itself would suffice.
Quoted 4 lines
Again, you're assuming that the 'canonical patch' should have no prefixes. This is simply a matter of convention (whether -p0 or -p1 is preferred by the project when applying a patch), and that convention happens to be -p1 for many projects. You're assuming -p0.
I understood that you're using git. I don't know how it works, so I need some data..
Do you use 'git apply'?
Do you use 'git apply -p1 for git patches? (with a/ b/ prefixes) Do you use 'git apply -p1 for non-git diffs? (without a/ b/ prefixes)
Quoted 3 lines
Anyway, since the current version of
patch.pydoes what we need, there's little incentive for us to update/change things. If you consider a 'canonical patch' to be -p0, we'll just keep our changed copy :)
I am interested to make patch.py user experience as easy as I can, and maintaining changed copy is not a really good ux for me. =) And I am also interested to investigate the nature of those prefixes that I don't know about.
Signature · 1 line
anatoly t.
Re: [PATCH 1/3] backports: update patch Python library
Quoted 8 lines · anatoly techtonik
Quoted 5 lines
Quoted 2 lines
patch.pyis smart enough to strip only a/ and b/ prefixes, and do this automatically when it is needed.Well, yes, but it doesn't auto-detect other prefixes. So if I diff something manually, then the prefixes aren't removed.
There are no other prefixes. Everything else are real directories that exist when you create the patch. Isn't it?
Well, it depends. You could make an "unmodified" copy of the code, and put it into a directory
foo-project.orig/
and modify the copy in
foo-project/
and then diff there, and you'd end up with headers foo-project(.orig)/ and still have to use -p1 when applying the patch. That's the convent in Linux, regardless of how you make those prefixes (manually like I just described, or useless prefixes like git's a/ b/, or whatever)
Quoted 5 lines
Quoted 4 lines
As a result, I
must generate the patch using git if I want it to work right, or must go against the -p1 convention when generating it manually. Both of those are cumbersome and hard to remember.
Quoted 8 lines
Usually you need to rename old directory to something like:
Quoted 1 line
myapp.old
and then run 'diff -u3 myapp.old myapp'
No prefixes are added, and
patch.pyis smart enough to detect that there is no myapp.old and apply patch to the myapp/ directory (well, actually you need to make sure that myapp.old does not exist forpatch.pyto find myapp/).
Yeah, but the normal convention would be for a patch to have "myapp.old/" in it, but the person applying it would go into "myapp/" and use patch -p1.
Quoted 7 lines
Quoted 3 lines
IOW, you're assuming that a 'real patch' has no prefix, and a 'git patch' has useless a/ and b/ prefixes. But that relies on a certain convention about a 'real patch' which isn't true in the Linux community.
Yes, I want to know about those prefixes in Linux community, because I developed this tool on Windows and test database doesn't have any samples.
See above, pretty much :)
Quoted 6 lines
Quoted 2 lines
We use it to apply patches within the backport project, those patches are stored in the project and applied against upstream Linux code.
Yes. I've seen that. =)
:-)
Quoted 5 lines
I more interested in complete like session recorded session, like standing behind the shoulder and watching, so that I can think on how to make
patch.pyusage more natural, rather than trying to instruct people how to use. But that's ideal case. I think that an exemplary shell session where the annoyance benefits itself would suffice.
Ah. There's no exemplary shell session. We just use it in a script, so the shell session looks like
./gentree.py --some-options bla bla bla
Quoted 2 lines
I understood that you're using git. I don't know how it works, so I need some data..
Ok, sure. So there are two ways we use git.
One, to generate a patch, using some variant of "git diff
Quoted 1 line
/tmp/my.patch" or "git format-patch ...", both of which add a/ b/
prefixes.
The second use is to apply a patch received from the mailing list.
Note that only the first is really relevant for the backport project and this discussion, because obviously the latter doesn't use patch.py. *However*, we would like the backport project's workflow to be compatible with the second use case for git.
Quoted 3 lines
Do you use 'git apply'?
Do you use 'git apply -p1for git patches? (with a/ b/ prefixes) Do you use 'git apply -p1for non-git diffs? (without a/ b/ prefixes)
So, as a Linux maintainer or contributor, the answer to these is yes and no, we mostly use "git am" and not "git apply" to apply git patches and non-git diffs.
However, due to how git works, non-git diffs are required to have *some* prefixes, whether they're called a/ b/ or something else, since -p1 is actually the default. I could specify -p0, but that wouldn't be canonical, and I'm lazy. For example, if I have a git tree that contains a file called net/mac80211/tx.c (real life example), and I try to apply a patch that looks like
--- net/mac80211/tx.c
+++ net/mac80211/tx.c
...
then git am/git apply will say
error: mac80211/tx.c: No such file or directory
as it stripped one path component.
As a result, all patches that we throw around about Linux are essentially required to have a "dead" first component (a/ b/ or whatever else.)
Now, that's the second use case. The first use case in the backports project doesn't use git am (it doesn't usually modify a git tree). However, given the above conventions for the git use case, it also requires that all input patches that are part of the backport project be applied with the -p1 that is the implicit default in git. As a result, patches in the backports project need some prefix.
Now this then is the cause of the problem - your current patch.py treats git patches and manually created patches differently. We use patch.py to check which files a given patch changes using this code:
patched_file = '/'.join(p.items[0].source.split('/')[1:])
Now, you can see the [1:] in there, which is basically the equivalent of '-p1'. If we do this to a manually created patch that has --- linux.orig/net/mac80211/tx.c
+++ linux/net/mac80211/tx.c
it will result in the correct "net/mac80211/tx.c". However, if I do it to a git patch, like
diff ...
index ...
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
then the code above would result in just "mac80211/tx.c". I'd have to special-case this in the python code, checking the patch item's type before conditionally doing the [1:]. That is cumbersome and probably also error-prone, since it'd break when you put in workarounds like you just did for google code.
Therefore, I patched out the patch detection and automatic a/ b/ stripping. It'd be more maintainable if I was able to turn it off, rather than patch it out, at patch object instantiation.
Now, there's another issue - we don't use patch.py to actually apply the patch, but run 'patch -p1 < ...' instead. I'm not sure any more if there was a good reason for this, maybe I just didn't trust patch.py enough at the time, or maybe it's because the old code just ran patch -p1 unconditionally, I don't remember. We could possibly change this, but it wouldn't affect the above problem because we first have to check whether we should apply the patch at all, which is what we do with the check
above: the backports project is built to work if you only have a subset of the files patched by patches actually present, which is why we need to check which files a patch touches before trying to apply it.
Quoted 8 lines
Quoted 3 lines
Anyway, since the current version of
patch.pydoes what we need, there's little incentive for us to update/change things. If you consider a 'canonical patch' to be -p0, we'll just keep our changed copy :)I am interested to make
patch.pyuser experience as easy as I can, and maintaining changed copy is not a really good ux for me. =) And I am also interested to investigate the nature of those prefixes that I don't know about.
I hope the above helped with that?
johannes
PATCH 2/3 lib/patch.py: add top header parsing support
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Add a top_header for cases where a patchset might have a full header that we may want users to keep around.
--- lib/patch.py | 2 ++ 1 file changed, 2 insertions(+)
lib/patch.py +2 -0
@@ -201,6 +201,7 @@ class PatchSet(object): # list of Patch objects self.items = [] + self.top_header = "" self.errors = 0 # fatal parsing errors self.warnings = 0 # non-critical warnings
@@ -303,6 +304,7 @@ class PatchSet(object): if headscan: while not fe.is_empty and not fe.line.startswith("--- "): header.append(fe.line) + self.top_header += fe.line fe.next() if fe.is_empty: if p == None:
Signature · 1 line
1.7.10.4
Re: [PATCH 2/3] lib/patch.py: add top header parsing support
Quoted 12 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
Add a
top_headerfor cases where a patchset might have a full header that we may want users to keep around.# list of Patch objects self.items = []lib/patch.py +1
-0+ self.top_header = "" self.errors = 0 # fatal parsing errors self.warnings = 0 # non-critical warnings
lib/patch.py class PatchSet(object): · line 308
Quoted 5 lines
lib/patch.py +1
-0@@ -303,6 +304,7 @@ class PatchSet(object): if headscan: while not fe.is_empty and not fe.line.startswith("--- "): header.append(fe.line) + self.top_header += fe.line fe.next()
Looks fine to me, though I wonder if we could somehow get at that "header" list? Anatoly?
johannes
PATCH 3/3 gentree.py: keep patch headers for patch refresh
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Without this change we were removing patch headers when refreshing patches.
--- gentree.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
gentree.py +3 -1
@@ -401,7 +401,9 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, return 2 if args.refresh: - pfilef = open(pfile + '.tmp', 'w') + pfilef = open(pfile + '.tmp', 'a') + pfilef.write(p.top_header) + pfilef.flush() for patchitem in p.items: patched_file = '/'.join(patchitem.source.split('/')[1:]) fullfn = os.path.join(args.outdir, patched_file)
Signature · 1 line
1.7.10.4
Johannes Berg
AppliedQuoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This changeset updates the backports project to enable keeping headers around upon patch refresh. We now use a Python library for managing patches, update that library to the the latest from svn trunk, make a small change to it and then modify our
gentree.pyto take advantage of it.
Applied, with the change to remove the HG/GIT detection again.
Quoted 2 lines
Anatoly, feel free to incorporate the
patch.pychange to your respective upstream if you see it fit.
If you do, let us know and we can update again :)
johannes