Julian Foad wrote on Wed, Apr 11, 2018 at 08:21:19 +0100:
> Running "release.py create-tag" just now failed:
> 
> + release.py --base-dir /opt/svnrm create-tag 1.10.0 r1827917
> INFO:root:Creating tag for 1.10.0
> r1828867 committed by julianfoad at 2018-04-11T07:00:33.547290Z
> INFO:root:Bumping revisions on the branch
> .../subversion/svnmucc/svnmucc.c:235,
> .../subversion/libsvn_client/mtcc.c:1485,
> .../subversion/libsvn_client/mtcc.c:1262,
> .../subversion/libsvn_client/mtcc.c:1180,
> .../subversion/libsvn_ra_serf/commit.c:2186,
> .../subversion/libsvn_ra_serf/util.c:1032,
> .../subversion/libsvn_ra_serf/util.c:981,
> .../subversion/libsvn_ra_serf/util.c:946,
> .../subversion/libsvn_ra_serf/multistatus.c:558: 
> (apr_err=SVN_ERR_RA_OUT_OF_DATE)
> svnmucc: E170004: Item '/subversion/branches/1.10.x/STATUS' is out of date
> Traceback (most recent call last):
>   File ".../tools/dist/release.py", line 1558, in <module>
>     main()
>   File ".../tools/dist/release.py", line 1554, in main
>     args.func(args)
>   File ".../tools/dist/release.py", line 854, in create_tag
>     'put', STATUS.name, STATUS.url,
>   File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
>     raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['svnmucc', '-r', '1827917', '-m', 
> 'Post-release housekeeping: bump the 1.10.x branch to 1.10.1.', 'put', 
> '/tmp/tmpAxzWoN', 
> 'https://svn.apache.org/repos/asf/subversion/branches/1.10.x/subversion/include/svn_version.h',
>  'put', '/tmp/tmpUPWFkj', 
> 'https://svn.apache.org/repos/asf/subversion/branches/1.10.x/STATUS']' 
> returned non-zero exit status 1
> 
> It's because it uses "svnmucc -r <REV> put <...>" but STATUS has already been 
> modified between r<REV> and HEAD.

Agreed.  It's perfectly possible for the branch to have changed between the
magic revision and HEAD.  When editing STATUS, the base revision (argument to
the -r option) should be HEAD resolved to a number.

Something like this, perhaps?

[[[
release.py create-tag: Fix an out-of-date error when the branch has changed
after the magic revision.

* tools/dist/release.py
  (create_tag): Use HEAD rather than the magic revision as the base revision
    for the "Post-release housekeeping" commit.
]]]

[[[
Index: tools/dist/release.py
===================================================================
--- tools/dist/release.py       (revision 1828071)
+++ tools/dist/release.py       (working copy)
@@ -828,11 +828,14 @@ def create_tag(args):
                               (args.version.major, args.version.minor,
                                args.version.patch + 1))
 
+        HEAD = subprocess.check_output(['svn', 'info', '--show-item=revision',
+                                        '--', url]).strip()
+        HEAD = int(HEAD)
         def file_object_for(relpath):
             fd = tempfile.NamedTemporaryFile()
             url = branch + '/' + relpath
             fd.url = url
-            subprocess.check_call(['svn', 'cat', '%s@%d' % (url, args.revnum)],
+            subprocess.check_call(['svn', 'cat', '%s@%d' % (url, HEAD)],
                                   stdout=fd)
             return fd
 
@@ -846,7 +849,7 @@ def create_tag(args):
 
         svn_version_h.seek(0, os.SEEK_SET)
         STATUS.seek(0, os.SEEK_SET)
-        subprocess.check_call(['svnmucc', '-r', str(args.revnum),
+        subprocess.check_call(['svnmucc', '-r', str(HEAD),
                                '-m', 'Post-release housekeeping: '
                                      'bump the %s branch to %s.'
                                % (branch.split('/')[-1], str(new_version)),
]]]

Cheers,

Daniel

Reply via email to