# If the working copy is an old revision, lets get that version too for comparison.
# If the working copy is an old revision, lets get that
# version too for comparison.
if ( defined($wrev) and $wrev != $meta->{revision} )
{
$oldmeta = $updater->getmeta($filename, $wrev);
@ -1585,49 +1592,95 @@ sub req_status
@@ -1585,49 +1592,95 @@ sub req_status
# TODO : All possible statuses aren't yet implemented
my $status;
# Files are up to date if the working copy and repo copy have the same revision, and the working copy is unmodified
$status = "Up-to-date" if ( defined ( $wrev ) and defined($meta->{revision}) and $wrev == $meta->{revision}
and
( ( $state->{entries}{$filename}{unchanged} and ( not defined ( $state->{entries}{$filename}{conflict} ) or $state->{entries}{$filename}{conflict} !~ /^\+=/ ) )
or ( defined($state->{entries}{$filename}{modified_hash}) and $state->{entries}{$filename}{modified_hash} eq $meta->{filehash} ) )
);
# Need checkout if the working copy has an older revision than the repo copy, and the working copy is unmodified
$status ||= "Needs Checkout" if ( defined ( $wrev ) and defined ( $meta->{revision} ) and $meta->{revision} > $wrev
and
( $state->{entries}{$filename}{unchanged}
or ( defined($state->{entries}{$filename}{modified_hash}) and $state->{entries}{$filename}{modified_hash} eq $oldmeta->{filehash} ) )
);
# Need checkout if it exists in the repo but doesn't have a working copy
$status ||= "Needs Checkout" if ( not defined ( $wrev ) and defined ( $meta->{revision} ) );
# Locally modified if working copy and repo copy have the same revision but there are local changes
$status ||= "Locally Modified" if ( defined ( $wrev ) and defined($meta->{revision}) and $wrev == $meta->{revision} and $state->{entries}{$filename}{modified_filename} );
# Needs Merge if working copy revision is less than repo copy and there are local changes
$status ||= "Needs Merge" if ( defined ( $wrev ) and defined ( $meta->{revision} ) and $meta->{revision} > $wrev and $state->{entries}{$filename}{modified_filename} );
$status ||= "Locally Added" if ( defined ( $state->{entries}{$filename}{revision} ) and not defined ( $meta->{revision} ) );
$status ||= "Locally Removed" if ( defined ( $wrev ) and defined ( $meta->{revision} ) and -$wrev == $meta->{revision} );
$status ||= "Unresolved Conflict" if ( defined ( $state->{entries}{$filename}{conflict} ) and $state->{entries}{$filename}{conflict} =~ /^\+=/ );
$status ||= "File had conflicts on merge" if ( 0 );
# Files are up to date if the working copy and repo copy have
# the same revision, and the working copy is unmodified
if ( defined ( $wrev ) and defined($meta->{revision}) and
$wrev == $meta->{revision} and
( ( $state->{entries}{$filename}{unchanged} and
( not defined ( $state->{entries}{$filename}{conflict} ) or
$state->{entries}{$filename}{conflict} !~ /^\+=/ ) ) or
( defined($state->{entries}{$filename}{modified_hash}) and
$state->{entries}{$filename}{modified_hash} eq
$meta->{filehash} ) ) )
{
$status = "Up-to-date";
}
# Need checkout if the working copy has an older revision than
# the repo copy, and the working copy is unmodified
if ( defined ( $wrev ) and defined ( $meta->{revision} ) and
$meta->{revision} > $wrev and
( $state->{entries}{$filename}{unchanged} or
( defined($state->{entries}{$filename}{modified_hash}) and
$state->{entries}{$filename}{modified_hash} eq
$oldmeta->{filehash} ) ) )
{
$status ||= "Needs Checkout";
}
# Need checkout if it exists in the repo but doesn't have a working
# copy
if ( not defined ( $wrev ) and defined ( $meta->{revision} ) )
{
$status ||= "Needs Checkout";
}
# Locally modified if working copy and repo copy have the
# same revision but there are local changes
if ( defined ( $wrev ) and defined($meta->{revision}) and
$wrev == $meta->{revision} and
$state->{entries}{$filename}{modified_filename} )
{
$status ||= "Locally Modified";
}
# Needs Merge if working copy revision is less than repo copy
# and there are local changes
if ( defined ( $wrev ) and defined ( $meta->{revision} ) and
$meta->{revision} > $wrev and
$state->{entries}{$filename}{modified_filename} )
{
$status ||= "Needs Merge";
}
if ( defined ( $state->{entries}{$filename}{revision} ) and
not defined ( $meta->{revision} ) )
{
$status ||= "Locally Added";
}
if ( defined ( $wrev ) and defined ( $meta->{revision} ) and
-$wrev == $meta->{revision} )
{
$status ||= "Locally Removed";
}
if ( defined ( $state->{entries}{$filename}{conflict} ) and
# if we have been given -r, and we don't have a $file2 yet, lets get one
# if we have been given -r, and we don't have a $file2 yet, lets
# get one
if ( defined ( $revision1 ) and not defined ( $file2 ) )
{
( undef, $file2 ) = tempfile( DIR => $TEMP_DIR, OPEN => 0 );
@ -1733,21 +1791,37 @@ sub req_diff
@@ -1733,21 +1791,37 @@ sub req_diff
# We need to have retrieved something useful
next unless ( defined ( $meta1 ) );
# Files to date if the working copy and repo copy have the same revision, and the working copy is unmodified
next if ( not defined ( $meta2 ) and $wrev == $meta1->{revision}
and
( ( $state->{entries}{$filename}{unchanged} and ( not defined ( $state->{entries}{$filename}{conflict} ) or $state->{entries}{$filename}{conflict} !~ /^\+=/ ) )
or ( defined($state->{entries}{$filename}{modified_hash}) and $state->{entries}{$filename}{modified_hash} eq $meta1->{filehash} ) )
);
# Files to date if the working copy and repo copy have the same
# revision, and the working copy is unmodified
if ( not defined ( $meta2 ) and $wrev == $meta1->{revision} and
( ( $state->{entries}{$filename}{unchanged} and
( not defined ( $state->{entries}{$filename}{conflict} ) or
$state->{entries}{$filename}{conflict} !~ /^\+=/ ) ) or
( defined($state->{entries}{$filename}{modified_hash}) and
$state->{entries}{$filename}{modified_hash} eq
$meta1->{filehash} ) ) )
{
next;
}
# Apparently we only show diffs for locally modified files
next unless ( defined($meta2) or defined ( $state->{entries}{$filename}{modified_filename} ) );
unless ( defined($meta2) or
defined ( $state->{entries}{$filename}{modified_filename} ) )