~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to tools/hook-scripts/persist-ephemeral-txnprops.py

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#
 
3
#
 
4
# Licensed to the Apache Software Foundation (ASF) under one
 
5
# or more contributor license agreements.  See the NOTICE file
 
6
# distributed with this work for additional information
 
7
# regarding copyright ownership.  The ASF licenses this file
 
8
# to you under the Apache License, Version 2.0 (the
 
9
# "License"); you may not use this file except in compliance
 
10
# with the License.  You may obtain a copy of the License at
 
11
#
 
12
#   http://www.apache.org/licenses/LICENSE-2.0
 
13
#
 
14
# Unless required by applicable law or agreed to in writing,
 
15
# software distributed under the License is distributed on an
 
16
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
17
# KIND, either express or implied.  See the License for the
 
18
# specific language governing permissions and limitations
 
19
# under the License.
 
20
#
 
21
#
 
22
 
 
23
import sys
 
24
import os
 
25
from svn import repos, fs, core
 
26
 
 
27
def duplicate_ephemeral_txnprops(repos_path, txn_name):
 
28
  fs_ptr = repos.fs(repos.open(repos_path))
 
29
  txn_t = fs.open_txn(fs_ptr, txn_name)
 
30
  for name, value in fs.txn_proplist(txn_t).items():
 
31
    if name.startswith(core.SVN_PROP_TXN_PREFIX):
 
32
      name = core.SVN_PROP_REVISION_PREFIX + \
 
33
                  name[len(core.SVN_PROP_TXN_PREFIX):]
 
34
      fs.change_txn_prop(txn_t, name, value)
 
35
 
 
36
def usage_and_exit(errmsg=None):
 
37
  stream = errmsg and sys.stderr or sys.stdout
 
38
  stream.write("""\
 
39
Usage:
 
40
 
 
41
   persist-ephemeral-txnprops.py REPOS_PATH TXN_NAME
 
42
 
 
43
Duplicate ephemeral transaction properties so that the information
 
44
they carry may persist as properties of the revision created once the
 
45
transaction is committed.  This is intended to be used as a Subversion
 
46
pre-commit hook script.
 
47
 
 
48
REPOS_PATH is the on-disk path of the repository whose transaction
 
49
properties are being examined/modified.  TXN_NAME is the name of the
 
50
transaction.
 
51
 
 
52
Ephemeral transaction properties, whose names all begin with the
 
53
prefix "%s", will be copied to new properties which use the
 
54
prefix "%s" instead.
 
55
 
 
56
""" % (core.SVN_PROP_TXN_PREFIX, core.SVN_PROP_REVISION_PREFIX))
 
57
  if errmsg:
 
58
    stream.write("ERROR: " + errmsg + "\n")
 
59
  sys.exit(errmsg and 1 or 0)
 
60
 
 
61
def main():
 
62
  argc = len(sys.argv)
 
63
  if argc != 3:
 
64
    usage_and_exit("Incorrect number of arguments.")
 
65
  repos_path = sys.argv[1]
 
66
  txn_name = sys.argv[2]
 
67
  duplicate_ephemeral_txnprops(repos_path, txn_name)
 
68
 
 
69
if __name__ == "__main__":
 
70
  main()