Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
forge001
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
forge001
Commits
a7e872a3
Commit
a7e872a3
authored
6 months ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
WIP: tool to show duplicates; more work needed to get better reports out of it
parent
3ed023fc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
textarchive/show_dups.pl
+100
-0
100 additions, 0 deletions
textarchive/show_dups.pl
with
100 additions
and
0 deletions
textarchive/show_dups.pl
0 → 100755
+
100
−
0
View file @
a7e872a3
#!/usr/bin/perl
use
strict
;
use
Data::
Dumper
;
$
Data::Dumper::
Indent
=
1
;
$
Data::Dumper::
SortKeys
=
1
;
my
$super_cat
=
SuperCat
->
new
();
print
__LINE__
,
"
super_cat:
",
Dumper
(
$super_cat
);
my
@PARS
=
();
while
(
my
$arg
=
shift
(
@ARGV
))
{
if
(
$arg
=~
/^-/
)
{
die
"
no options implemented
";
}
else
{
push
(
@PARS
,
$arg
);
}
}
foreach
my
$par
(
@PARS
)
{
$super_cat
->
read_catalog
(
$par
);
}
# print __LINE__, " super_cat: ", Dumper($super_cat);
print
__LINE__
.
"
cats:
",
Dumper
(
$super_cat
->
{
cats
});
$super_cat
->
show_dups
();
exit
(
0
);
package
SuperCat
;
sub
new
{
bless
{
keys
=>
{},
cats
=>
{},
count
=>
0
},
shift
}
sub
read_catalog
{
my
$self
=
shift
;
my
$cat
=
shift
;
if
(
exists
(
$self
->
{
cats
}
->
{
cat
}))
{
return
undef
;
}
my
$cat_num
=
++
$self
->
{
count
};
my
$cat_info
=
{
cat_number
=>
$cat_num
,
cat_name
=>
$cat
,
};
$self
->
{
cats
}
->
{
$cat
}
=
$cat_info
;
# push (@{$self->{cats}}
die
"
can't read cat=[
$cat
]
"
unless
(
open
(
CAT
,
'
<:utf8
',
$cat
));
my
$keys
=
$self
->
{
keys
};
while
(
<
CAT
>
)
{
chop
;
my
(
$md5
,
$x_file
,
$size
,
$path
)
=
split
('
',
$_
,
4
);
# print __LINE__, " md5=[$md5], size=[$size], path=[$path]\n";
my
$x
;
if
(
exists
(
$keys
->
{
$md5
}))
{
$x
=
$keys
->
{
$md5
}
}
else
{
$x
=
$keys
->
{
$md5
}
=
{
key
=>
$md5
,
count
=>
0
,
cats
=>
{},
};
}
$x
->
{
count
}
++
;
push
(
@
{
$x
->
{
cats
}
->
{
$cat_num
}},
$path
);
}
close
(
CAT
);
}
sub
show_dups
{
my
$self
=
shift
;
foreach
my
$key
(
keys
%
{
$self
->
{
keys
}})
{
my
$x
=
$self
->
{
keys
}
->
{
$key
};
# print main::Dumper($x);
if
(
$x
->
{
count
}
!=
1
)
{
print
main::
Dumper
(
$x
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment