source: subversion/applications/utils/revert/undo.pl @ 21142

Revision 21142, 919 bytes checked in by frederik, 4 years ago (diff)

allow undo module to override subsequent changes on objects

Line 
1#!/usr/bin/perl
2
3# Adapter script for Undo.pm module
4# exports Undo.pm functionality for command line use.
5
6use strict;
7use warnings;
8use Undo;
9
10if (scalar(@ARGV) != 4 || $ARGV[0] !~ /^(node|way|relation)$/)
11{
12    print <<EOF;
13usage: $0 <node|way|relation> <id> <username|changeset> <changeset>
14
15where
16  id : OSM id of the object to revert
17  username, changeset : username (alphanumeric) or changeset (numeric)
18     of the change to revert
19  changeset : id of changeset to use for revert action
20EOF
21    exit;
22}
23
24my ($what, $id, $undo_what, $changeset) = @ARGV;
25
26my $undo_user;
27my $undo_changeset;
28
29if ($undo_what =~ /^[0-9]+(,[0-9]+)*$/) 
30{ 
31    foreach (split(/,/, $undo_what))
32    {
33        $undo_changeset->{$_} = 1;
34    } 
35} 
36else 
37{ 
38    foreach (split(/,/, $undo_what))
39    {
40        $undo_user->{$_} = 1;
41    } 
42}
43
44exit 1 if (!defined(Undo::undo($what, $id, $undo_user, $undo_changeset, $changeset)));
45exit 0
46
Note: See TracBrowser for help on using the repository browser.