Dear Albert ARIBAUD, In message <4ddab341.20...@aribaud.net> you wrote: > > > For example, instead of applying a patch directly from my mailbox I > > use this file only to get the hash value for the PW entry, and then > > use pwclient to apply it and to update it's state: > > > > HASH=$(pwparser.py --hash<$PATCH) > > if [ -z "$HASH" ] > > then > > echo "ERROR: $PATCH - no such entry in PatchWork">&2 > > exit 1 > > fi > > > > if pwclient apply -h $HASH > > then > > pwclient update -s 'Accepted' -h $HASH > > fi > > > > This is extremely convenient as it automatically takes care of both > > the Acks and the state change. > > Thanks. Looks like this could be handy for many others. Maybe it should > be 'backported' into pwclient itself as a new command.
Note that there is a caveat of this approach. Or call it bug in PW. We frequently see patch series, which get posted in several versions. Quite often not all patches are changed, so it happens that for example patch 3/8 is the same in all versions 2, 3 and 4 of the patch series. That means all versions of this patch have the same hash. Usually I apply the latest version, and want to change the status of this one, but the 'pwclient -h $HASH' will always reference the _oldest_ version of the patch. So watchout when you see it changing the state from "superseded" to "applied" - usually this means it changed the wrong version. [I reported this on the PW ML, but no response yet.] I should mention that I have hacked pwclient a bit to use "git am" instead of plain "patch", and to report the status change: @@ -110,7 +110,7 @@ (os.path.basename(sys.argv[0]))) sys.stderr.write("Where <action> is one of:\n") sys.stderr.write( -""" apply <ID> : Apply a patch (in the current dir, using -p1) +""" apply <ID> : Apply a patch (using 'git-am -3 -u --whitespace=strip') get <ID> : Download a patch and save it locally projects : List all projects states : Show list of potential patch states @@ -260,7 +260,7 @@ print "Description: %s" % patch['name'] s = rpc.patch_get_mbox(patch_id) if len(s) > 0: - proc = subprocess.Popen(['patch', '-p1'], stdin = subprocess.PIPE) + proc = subprocess.Popen(['git', 'am', '-3', '-u', '--whitespace=strip'], stdin = subprocess.PIPE) proc.communicate(s) else: sys.stderr.write("Error: No patch content found\n") @@ -280,6 +280,8 @@ if state_id == 0: sys.stderr.write("Error: No State found matching %s*\n" % state) sys.exit(1) + old_id = patch['state'] + sys.stderr.write("## commit: %s state: %s ==> %s\n" % (commit, old_id, state)) params['state'] = state_id if commit: Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de The only perfect science is hind-sight. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot