scramble-tree.py

Checkout Tools
  • last updated 1 hour ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Require Python ≥2.7 for Subversion 1.9, part 2: coding simplifications.

* build/generator/gen_win.py (hashlib_md5),

* build/transform_sql.py (operator.methodcaller),

* subversion/bindings/swig/python/svn/core.py (SubversionException.message),

* tools/dev/scramble-tree.py (hashlib_md5)

* tools/dist/release.py (__future__.with_statement):

Remove conditional code for now-unsupported Python versions.

* subversion/bindings/ctypes-python/csvn/ext/callback_receiver.py

Note a possible code simplification.

  1. … 5 more files in changeset.
Apply ASF license headers to a number of files included under that license

but lacking said header.

Patch by: Niall Pemberton <niallp{_AT_}apache.org>

  1. … 175 more files in changeset.
Python 3 compatibility:

Try to use hashlib module.

* build/generator/gen_vcnet_vcproj.py

(Generator.makeguid):

* tools/dev/scramble-tree.py

(hashDir.gen_seed): Try to use hashlib module.

  1. … 1 more file in changeset.
Python 3 compatibility:

Use os.walk() instead of os.path.walk().

* subversion/tests/cmdline/changelist_tests.py:

* subversion/tests/cmdline/svntest/main.py:

* subversion/tests/cmdline/svntest/wc.py:

* tools/backup/hot-backup.py.in:

* tools/client-side/change-svn-wc-format.py:

* tools/dev/check-license.py:

* tools/dev/scramble-tree.py:

* win-tests.py: Use os.walk() instead of os.path.walk().

  1. … 7 more files in changeset.
Python 3 compatibility:

Update calls to print() in 'tools' directory.

* tools/backup/hot-backup.py.in:

* tools/bdb/erase-all-text-data.py:

* tools/bdb/svn-bdb-view.py:

* tools/bdb/whatis-rep.py:

* tools/client-side/change-svn-wc-format.py:

* tools/client-side/server-version.py:

* tools/dev/check-license.py:

* tools/dev/contribulyze.py:

* tools/dev/datecheck.py:

* tools/dev/gen-javahl-errors.py:

* tools/dev/graph-dav-servers.py:

* tools/dev/iz/ff2csv.py:

* tools/dev/iz/find-fix.py:

* tools/dev/mlpatch.py:

* tools/dev/normalize-dump.py:

* tools/dev/po-merge.py:

* tools/dev/random-commits.py:

* tools/dev/scramble-tree.py:

* tools/dev/svn-merge-revs.py:

* tools/dev/verify-history.py:

* tools/dev/which-error.py:

* tools/dist/gen_nightly_ann.py:

* tools/dist/getsigs.py:

* tools/dist/post-to-tigris.py:

* tools/dist/write-announcement.py:

* tools/examples/blame.py:

* tools/examples/check-modified.py:

* tools/examples/dumpprops.py:

* tools/examples/getfile.py:

* tools/examples/get-location-segments.py:

* tools/examples/geturl.py:

* tools/examples/putfile.py:

* tools/examples/revplist.py:

* tools/examples/svnlook.py:

* tools/examples/svnshell.py:

* tools/hook-scripts/mailer/tests/mailer-tweak.py:

* tools/hook-scripts/svn2feed.py:

* tools/po/l10n-report.py:

* tools/server-side/fsfs-reshard.py:

* tools/server-side/svn-backup-dumps.py: Call print() or file.write().

  1. … 39 more files in changeset.
Channeling Erik Hülsmann, remove all trailing whitespace within our source

tree:

for extsn in c h cpp java py pl rb; do

sed -i -e 's/[ \t]*$//' `find . -name "*.$extsn" | xargs grep '[ \t]$' -l`

done

Inspired by: ehu

  1. … 449 more files in changeset.
For every getopt-using Python script which does not already do so,

use GNU-style getopt if available.

* gen-make.py

* tools/hook-scripts/log-police.py

* tools/hook-scripts/svnperms.py

* tools/dev/contribulyze.py

* tools/dev/iz/ff2csv.py

* tools/dev/iz/find-fix.py

* tools/dev/lock-check.py

* tools/dev/scramble-tree.py

* tools/examples/dumpprops.py

* tools/examples/revplist.py

* tools/examples/putfile.py

* tools/examples/getfile.py

* tools/examples/blame.py

* contrib/client-side/svnmerge.py

* contrib/hook-scripts/svn2rss.py

* build/win32/make_dist.py

  1. … 15 more files in changeset.
Set svn:eol-style='native' on some text files that were lacking it.

  1. … 44 more files in changeset.
Change "#!/usr/bin/env python2" to "#!/usr/bin/env python" everywhere.

"python2" is not a standard name - by using it, we are more likely to force

users to have to edit our scripts to point them at a real Python interpreter,

than to help our scripts work out of the box.

* contrib/hook-scripts/pre-commit-check.py:

* tools/hook-scripts/svnperms.py:

* tools/hook-scripts/mailer/mailer.py:

* tools/hook-scripts/mailer/tests/mailer-tweak.py:

* tools/dev/iz/ff2csv.py:

* tools/dev/lock-check.py:

* tools/dev/scramble-tree.py:

* tools/examples/putfile.py:

* tools/examples/revplist.py:

* tools/examples/dumpprops.py:

* tools/examples/svnlook.py:

* tools/examples/svnshell.py:

* tools/examples/getfile.py:

* tools/examples/blame.py:

* tools/examples/geturl.py:

Change "#!/usr/bin/env python2" to "#!/usr/bin/env python".

  1. … 14 more files in changeset.
Minor bugfix: don't remove more lines than exist.
Update the usage message to include --help, --limit and --quiet options.
Make the Scrambler store up a operation list, and then act on it

later. Add support for --limit, which shrinks that operation list to

a particular size before the operations are carried out.

* tools/dev/scramble-tree.py

(Scrambler.__init__): Print the seed, and only if not running

silent. Also, add init a new ops list.

(Scrambler.shrink_list): Re-promote to a class-level helper, and add

a parameter to specify the final size of the shrunken list.

(Scrambler.maybe_add_file, Scrambler.munge_file): Removed, contents

merged into Scrambler.enact.

(Scrambler.get_randomizer, Scrambler.schedule_munge,

Scrambler.schedule_addition, Scrambler.enact): New.

(main): Add support for --limit flag.

* tools/dev/scramble-tree.py

(Scrambler._make_new_file): Hey. Make the size of the unique

new-file space a liiiiittle bit larger (forgot to undo some

debugging state).

Add --quiet/-q support to scramble-tree.py, and do a better job of

adding new files.

* tools/dev/scramble-tree.py

(Scrambler.__init__): Accept 'quiet' argument, and lose self.file_name.

(Scrambler._make_new_file): New helper.

(Scrambler._mod_append_to_file, Scrambler._mod_remove_from_file,

Scrambler._mod_delete_file): Speak only when not asked to do otherwise!

(Scrambler.maybe_add_file): Be quiet when told to, and use the new

file-maker helper.

(main): Add support for a --quiet/-q flag.

Fix some bugs in scramble-tree.py (paths-with-spaces handling; VC-less

operation not performing deletions).

* tools/dev/scramble-tree.py

(NoVCActions): New.

(CVSActions.add_file, CVSActions.remove_file, SVNActions.add_file,

SVNActions.remove_file): Quote the target path.

(Scrambler._mod_delete_file, Scrambler.maybe_add_file): Expect

non-None self.vc_actions.

(main): Initialize vc_actions to an instance of NoVCActions.

Teach scramble-tree.py to work on CVS working copies, too.

Patch by: Elchan Aliev <aelchan@collab.net>

me

* tools/dev/scramble-tree.py

(main): Was __main__ (kinda). Now accepts --use-cvs.

(usage): Update usage message.

(VCActions, CVSActions, SVNActions): New.

(Scrambler.__init__): Take vc_actions object instead of use_svn flag.

(Scrambler._mod_delete_file, Scrambler.maybe_add_file): Use the

vc_actions object if it exists, instead of just doing Subversion

stuff.

Fix the header comment.
Teach scramble-tree.py to use Subversion, give it a dry-run mode, and

clean up a bunch of stuff.

Suggested by: Elchan Aliev <aelchan@collab.net>

* tools/dev/scramble-tree.py

(hashDir.walker_callback, walker_callback): Whitespace mods only.

(Scrambler.__init__): Add 'use_svn' and 'dry_run' parameters.

(Scrambler._mod_append_to_file): Was append_to_file, and now takes

an explicit path (instead of expecting self.path). Do nothing in

dry_run mode.

(Scrambler._mod_delete_file): Was delete_file, and now takes an

explicit path (instead of expecting self.path). Also, if use_svn,

use svn. But do nothing in dry_run mode.

(Scrambler.shrink_list): Moved into...

(Scrambler._mod_remove_from_file): ...here. Which was

remove_from_file. And which now takes an explicit path (instead

of expecting self.path). But which does nothing in dry_run mode.

(Scrambler.munge_file): Pass path to the mod function.

(Scrambler.maybe_add_file): If use_svn, use svn. Unless in dry_run

mode, in which case, do nothing.

(usage): Update usage message.

(main): Parse new options and stuff.

Remove unused module imports and fix shebang line.

* tools/dev/scramble-tree.py: Less code good.

* subversion/tools/dev/scramble-tree.py

(hashDir.gen_seed): Was md5(). Now, sort the list of contents

before stringing them together, and encode them for human-readability.

(walker_callback): Accept optional seed from the command-line, and

in any case, print the seed used. Update calls to hashDir.gen_seed().

Incorporate suggested changes from Greg Stein.

* tools/dev/scramble-tree.py: Minor improvements.

Add a new script that makes a bunch of changes to a working copy (add

files, delete files, add text to files, and remove text from files).

See the comment at the top of the script for details. Thanks to Karl

Fogel for the lovely and beautiful documentation.

* tools/dev/scramble-tree.py: New file

    • -0
    • +176
    ./scramble-tree.py