@@ -1559,75 +1559,128 @@ sub req_status
15591559 # $log->debug("status state : " . Dumper($state));
15601560
15611561 # Grab a handle to the SQLite db and do any necessary updates
1562- my $updater = GITCVS::updater-> new($state -> {CVSROOT }, $state -> {module }, $log );
1562+ my $updater ;
1563+ $updater = GITCVS::updater-> new($state -> {CVSROOT }, $state -> {module }, $log );
15631564 $updater -> update();
15641565
1565- # if no files were specified, we need to work out what files we should be providing status on ...
1566+ # if no files were specified, we need to work out what files we should
1567+ # be providing status on ...
15661568 argsfromdir($updater );
15671569
15681570 # foreach file specified on the command line ...
15691571 foreach my $filename ( @{$state -> {args }} )
15701572 {
15711573 $filename = filecleanup($filename );
15721574
1573- next if exists ($state -> {opt }{l }) && index ($filename , ' /' , length ($state -> {prependdir })) >= 0;
1575+ if ( exists ($state -> {opt }{l }) &&
1576+ index ($filename , ' /' , length ($state -> {prependdir })) >= 0 )
1577+ {
1578+ next ;
1579+ }
15741580
15751581 my $meta = $updater -> getmeta($filename );
15761582 my $oldmeta = $meta ;
15771583
15781584 my $wrev = revparse($filename );
15791585
1580- # If the working copy is an old revision, lets get that version too for comparison.
1586+ # If the working copy is an old revision, lets get that
1587+ # version too for comparison.
15811588 if ( defined ($wrev ) and $wrev != $meta -> {revision } )
15821589 {
15831590 $oldmeta = $updater -> getmeta($filename , $wrev );
15841591 }
15851592
15861593 # TODO : All possible statuses aren't yet implemented
15871594 my $status ;
1588- # Files are up to date if the working copy and repo copy have the same revision, and the working copy is unmodified
1589- $status = " Up-to-date" if ( defined ( $wrev ) and defined ($meta -> {revision }) and $wrev == $meta -> {revision }
1590- and
1591- ( ( $state -> {entries }{$filename }{unchanged } and ( not defined ( $state -> {entries }{$filename }{conflict } ) or $state -> {entries }{$filename }{conflict } !~ / ^\+ =/ ) )
1592- or ( defined ($state -> {entries }{$filename }{modified_hash }) and $state -> {entries }{$filename }{modified_hash } eq $meta -> {filehash } ) )
1593- );
1594-
1595- # Need checkout if the working copy has an older revision than the repo copy, and the working copy is unmodified
1596- $status ||= " Needs Checkout" if ( defined ( $wrev ) and defined ( $meta -> {revision } ) and $meta -> {revision } > $wrev
1597- and
1598- ( $state -> {entries }{$filename }{unchanged }
1599- or ( defined ($state -> {entries }{$filename }{modified_hash }) and $state -> {entries }{$filename }{modified_hash } eq $oldmeta -> {filehash } ) )
1600- );
1601-
1602- # Need checkout if it exists in the repo but doesn't have a working copy
1603- $status ||= " Needs Checkout" if ( not defined ( $wrev ) and defined ( $meta -> {revision } ) );
1604-
1605- # Locally modified if working copy and repo copy have the same revision but there are local changes
1606- $status ||= " Locally Modified" if ( defined ( $wrev ) and defined ($meta -> {revision }) and $wrev == $meta -> {revision } and $state -> {entries }{$filename }{modified_filename } );
1607-
1608- # Needs Merge if working copy revision is less than repo copy and there are local changes
1609- $status ||= " Needs Merge" if ( defined ( $wrev ) and defined ( $meta -> {revision } ) and $meta -> {revision } > $wrev and $state -> {entries }{$filename }{modified_filename } );
1610-
1611- $status ||= " Locally Added" if ( defined ( $state -> {entries }{$filename }{revision } ) and not defined ( $meta -> {revision } ) );
1612- $status ||= " Locally Removed" if ( defined ( $wrev ) and defined ( $meta -> {revision } ) and -$wrev == $meta -> {revision } );
1613- $status ||= " Unresolved Conflict" if ( defined ( $state -> {entries }{$filename }{conflict } ) and $state -> {entries }{$filename }{conflict } =~ / ^\+ =/ );
1614- $status ||= " File had conflicts on merge" if ( 0 );
1595+ # Files are up to date if the working copy and repo copy have
1596+ # the same revision, and the working copy is unmodified
1597+ if ( defined ( $wrev ) and defined ($meta -> {revision }) and
1598+ $wrev == $meta -> {revision } and
1599+ ( ( $state -> {entries }{$filename }{unchanged } and
1600+ ( not defined ( $state -> {entries }{$filename }{conflict } ) or
1601+ $state -> {entries }{$filename }{conflict } !~ / ^\+ =/ ) ) or
1602+ ( defined ($state -> {entries }{$filename }{modified_hash }) and
1603+ $state -> {entries }{$filename }{modified_hash } eq
1604+ $meta -> {filehash } ) ) )
1605+ {
1606+ $status = " Up-to-date" ;
1607+ }
1608+
1609+ # Need checkout if the working copy has an older revision than
1610+ # the repo copy, and the working copy is unmodified
1611+ if ( defined ( $wrev ) and defined ( $meta -> {revision } ) and
1612+ $meta -> {revision } > $wrev and
1613+ ( $state -> {entries }{$filename }{unchanged } or
1614+ ( defined ($state -> {entries }{$filename }{modified_hash }) and
1615+ $state -> {entries }{$filename }{modified_hash } eq
1616+ $oldmeta -> {filehash } ) ) )
1617+ {
1618+ $status ||= " Needs Checkout" ;
1619+ }
1620+
1621+ # Need checkout if it exists in the repo but doesn't have a working
1622+ # copy
1623+ if ( not defined ( $wrev ) and defined ( $meta -> {revision } ) )
1624+ {
1625+ $status ||= " Needs Checkout" ;
1626+ }
1627+
1628+ # Locally modified if working copy and repo copy have the
1629+ # same revision but there are local changes
1630+ if ( defined ( $wrev ) and defined ($meta -> {revision }) and
1631+ $wrev == $meta -> {revision } and
1632+ $state -> {entries }{$filename }{modified_filename } )
1633+ {
1634+ $status ||= " Locally Modified" ;
1635+ }
1636+
1637+ # Needs Merge if working copy revision is less than repo copy
1638+ # and there are local changes
1639+ if ( defined ( $wrev ) and defined ( $meta -> {revision } ) and
1640+ $meta -> {revision } > $wrev and
1641+ $state -> {entries }{$filename }{modified_filename } )
1642+ {
1643+ $status ||= " Needs Merge" ;
1644+ }
1645+
1646+ if ( defined ( $state -> {entries }{$filename }{revision } ) and
1647+ not defined ( $meta -> {revision } ) )
1648+ {
1649+ $status ||= " Locally Added" ;
1650+ }
1651+ if ( defined ( $wrev ) and defined ( $meta -> {revision } ) and
1652+ -$wrev == $meta -> {revision } )
1653+ {
1654+ $status ||= " Locally Removed" ;
1655+ }
1656+ if ( defined ( $state -> {entries }{$filename }{conflict } ) and
1657+ $state -> {entries }{$filename }{conflict } =~ / ^\+ =/ )
1658+ {
1659+ $status ||= " Unresolved Conflict" ;
1660+ }
1661+ if ( 0 )
1662+ {
1663+ $status ||= " File had conflicts on merge" ;
1664+ }
16151665
16161666 $status ||= " Unknown" ;
16171667
16181668 my ($filepart ) = filenamesplit($filename );
16191669
1620- print " M =================================================================== \n " ;
1670+ print " M =======" . ( " = " x 60 ) . " \n " ;
16211671 print " M File: $filepart \t Status: $status \n " ;
16221672 if ( defined ($state -> {entries }{$filename }{revision }) )
16231673 {
1624- print " M Working revision:\t " . $state -> {entries }{$filename }{revision } . " \n " ;
1674+ print " M Working revision:\t " .
1675+ $state -> {entries }{$filename }{revision } . " \n " ;
16251676 } else {
16261677 print " M Working revision:\t No entry for $filename \n " ;
16271678 }
16281679 if ( defined ($meta -> {revision }) )
16291680 {
1630- print " M Repository revision:\t 1." . $meta -> {revision } . " \t $state ->{CVSROOT}/$state ->{module}/$filename ,v\n " ;
1681+ print " M Repository revision:\t 1." .
1682+ $meta -> {revision } .
1683+ " \t $state ->{CVSROOT}/$state ->{module}/$filename ,v\n " ;
16311684 print " M Sticky Tag:\t\t (none)\n " ;
16321685 print " M Sticky Date:\t\t (none)\n " ;
16331686 print " M Sticky Options:\t\t (none)\n " ;
@@ -1661,13 +1714,17 @@ sub req_diff
16611714 $revision1 =~ s / ^1\. // if ( defined ( $revision1 ) );
16621715 $revision2 =~ s / ^1\. // if ( defined ( $revision2 ) );
16631716
1664- $log -> debug(" Diffing revisions " . ( defined ($revision1 ) ? $revision1 : " [NULL]" ) . " and " . ( defined ($revision2 ) ? $revision2 : " [NULL]" ) );
1717+ $log -> debug(" Diffing revisions " .
1718+ ( defined ($revision1 ) ? $revision1 : " [NULL]" ) .
1719+ " and " . ( defined ($revision2 ) ? $revision2 : " [NULL]" ) );
16651720
16661721 # Grab a handle to the SQLite db and do any necessary updates
1667- my $updater = GITCVS::updater-> new($state -> {CVSROOT }, $state -> {module }, $log );
1722+ my $updater ;
1723+ $updater = GITCVS::updater-> new($state -> {CVSROOT }, $state -> {module }, $log );
16681724 $updater -> update();
16691725
1670- # if no files were specified, we need to work out what files we should be providing status on ...
1726+ # if no files were specified, we need to work out what files we should
1727+ # be providing status on ...
16711728 argsfromdir($updater );
16721729
16731730 # foreach file specified on the command line ...
@@ -1722,7 +1779,8 @@ sub req_diff
17221779 $file2 = $state -> {entries }{$filename }{modified_filename };
17231780 }
17241781
1725- # if we have been given -r, and we don't have a $file2 yet, lets get one
1782+ # if we have been given -r, and we don't have a $file2 yet, lets
1783+ # get one
17261784 if ( defined ( $revision1 ) and not defined ( $file2 ) )
17271785 {
17281786 ( undef , $file2 ) = tempfile( DIR => $TEMP_DIR , OPEN => 0 );
@@ -1733,21 +1791,37 @@ sub req_diff
17331791 # We need to have retrieved something useful
17341792 next unless ( defined ( $meta1 ) );
17351793
1736- # Files to date if the working copy and repo copy have the same revision, and the working copy is unmodified
1737- next if ( not defined ( $meta2 ) and $wrev == $meta1 -> {revision }
1738- and
1739- ( ( $state -> {entries }{$filename }{unchanged } and ( not defined ( $state -> {entries }{$filename }{conflict } ) or $state -> {entries }{$filename }{conflict } !~ / ^\+ =/ ) )
1740- or ( defined ($state -> {entries }{$filename }{modified_hash }) and $state -> {entries }{$filename }{modified_hash } eq $meta1 -> {filehash } ) )
1741- );
1794+ # Files to date if the working copy and repo copy have the same
1795+ # revision, and the working copy is unmodified
1796+ if ( not defined ( $meta2 ) and $wrev == $meta1 -> {revision } and
1797+ ( ( $state -> {entries }{$filename }{unchanged } and
1798+ ( not defined ( $state -> {entries }{$filename }{conflict } ) or
1799+ $state -> {entries }{$filename }{conflict } !~ / ^\+ =/ ) ) or
1800+ ( defined ($state -> {entries }{$filename }{modified_hash }) and
1801+ $state -> {entries }{$filename }{modified_hash } eq
1802+ $meta1 -> {filehash } ) ) )
1803+ {
1804+ next ;
1805+ }
17421806
17431807 # Apparently we only show diffs for locally modified files
1744- next unless ( defined ($meta2 ) or defined ( $state -> {entries }{$filename }{modified_filename } ) );
1808+ unless ( defined ($meta2 ) or
1809+ defined ( $state -> {entries }{$filename }{modified_filename } ) )
1810+ {
1811+ next ;
1812+ }
17451813
17461814 print " M Index: $filename \n " ;
1747- print " M =================================================================== \n " ;
1815+ print " M =======" . ( " = " x 60 ) . " \n " ;
17481816 print " M RCS file: $state ->{CVSROOT}/$state ->{module}/$filename ,v\n " ;
1749- print " M retrieving revision 1.$meta1 ->{revision}\n " if ( defined ( $meta1 ) );
1750- print " M retrieving revision 1.$meta2 ->{revision}\n " if ( defined ( $meta2 ) );
1817+ if ( defined ( $meta1 ) )
1818+ {
1819+ print " M retrieving revision 1.$meta1 ->{revision}\n "
1820+ }
1821+ if ( defined ( $meta2 ) )
1822+ {
1823+ print " M retrieving revision 1.$meta2 ->{revision}\n "
1824+ }
17511825 print " M diff " ;
17521826 foreach my $opt ( keys %{$state -> {opt }} )
17531827 {
@@ -1759,18 +1833,27 @@ sub req_diff
17591833 }
17601834 } else {
17611835 print " -$opt " ;
1762- print " $state ->{opt}{$opt } " if ( defined ( $state -> {opt }{$opt } ) );
1836+ if ( defined ( $state -> {opt }{$opt } ) )
1837+ {
1838+ print " $state ->{opt}{$opt } "
1839+ }
17631840 }
17641841 }
17651842 print " $filename \n " ;
17661843
1767- $log -> info(" Diffing $filename -r $meta1 ->{revision} -r " . ( $meta2 -> {revision } or " workingcopy" ));
1844+ $log -> info(" Diffing $filename -r $meta1 ->{revision} -r " .
1845+ ( $meta2 -> {revision } or " workingcopy" ));
17681846
17691847 ( $fh , $filediff ) = tempfile ( DIR => $TEMP_DIR );
17701848
17711849 if ( exists $state -> {opt }{u } )
17721850 {
1773- system (" diff -u -L '$filename revision 1.$meta1 ->{revision}' -L '$filename " . ( defined ($meta2 -> {revision }) ? " revision 1.$meta2 ->{revision}" : " working copy" ) . " ' $file1 $file2 > $filediff " );
1851+ system (" diff -u -L '$filename revision 1.$meta1 ->{revision}'" .
1852+ " -L '$filename " .
1853+ ( defined ($meta2 -> {revision }) ?
1854+ " revision 1.$meta2 ->{revision}" :
1855+ " working copy" ) .
1856+ " ' $file1 $file2 > $filediff " );
17741857 } else {
17751858 system (" diff $file1 $file2 > $filediff " );
17761859 }
@@ -1795,7 +1878,8 @@ sub req_log
17951878 # $log->debug("log state : " . Dumper($state));
17961879
17971880 my ( $minrev , $maxrev );
1798- if ( defined ( $state -> {opt }{r } ) and $state -> {opt }{r } =~ / ([\d .]+)?(::?)([\d .]+)?/ )
1881+ if ( defined ( $state -> {opt }{r } ) and
1882+ $state -> {opt }{r } =~ / ([\d .]+)?(::?)([\d .]+)?/ )
17991883 {
18001884 my $control = $2 ;
18011885 $minrev = $1 ;
@@ -1806,10 +1890,12 @@ sub req_log
18061890 }
18071891
18081892 # Grab a handle to the SQLite db and do any necessary updates
1809- my $updater = GITCVS::updater-> new($state -> {CVSROOT }, $state -> {module }, $log );
1893+ my $updater ;
1894+ $updater = GITCVS::updater-> new($state -> {CVSROOT }, $state -> {module }, $log );
18101895 $updater -> update();
18111896
1812- # if no files were specified, we need to work out what files we should be providing status on ...
1897+ # if no files were specified, we need to work out what files we
1898+ # should be providing status on ...
18131899 argsfromdir($updater );
18141900
18151901 # foreach file specified on the command line ...
@@ -1825,15 +1911,17 @@ sub req_log
18251911 if ( defined ( $minrev ) )
18261912 {
18271913 $log -> debug(" Removing revisions less than $minrev " );
1828- while ( scalar (@$revisions ) > 0 and $revisions -> [-1]{revision } < $minrev )
1914+ while ( scalar (@$revisions ) > 0 and
1915+ $revisions -> [-1]{revision } < $minrev )
18291916 {
18301917 pop @$revisions ;
18311918 }
18321919 }
18331920 if ( defined ( $maxrev ) )
18341921 {
18351922 $log -> debug(" Removing revisions greater than $maxrev " );
1836- while ( scalar (@$revisions ) > 0 and $revisions -> [0]{revision } > $maxrev )
1923+ while ( scalar (@$revisions ) > 0 and
1924+ $revisions -> [0]{revision } > $maxrev )
18371925 {
18381926 shift @$revisions ;
18391927 }
@@ -1850,22 +1938,32 @@ sub req_log
18501938 print " M access list:\n " ;
18511939 print " M symbolic names:\n " ;
18521940 print " M keyword substitution: kv\n " ;
1853- print " M total revisions: $totalrevisions ;\t selected revisions: " . scalar (@$revisions ) . " \n " ;
1941+ print " M total revisions: $totalrevisions ;\t selected revisions: " .
1942+ scalar (@$revisions ) . " \n " ;
18541943 print " M description:\n " ;
18551944
18561945 foreach my $revision ( @$revisions )
18571946 {
18581947 print " M ----------------------------\n " ;
18591948 print " M revision 1.$revision ->{revision}\n " ;
18601949 # reformat the date for log output
1861- $revision -> {modified } = sprintf (' %04d/%02d/%02d %s' , $3 , $DATE_LIST -> {$2 }, $1 , $4 ) if ( $revision -> {modified } =~ / (\d +)\s +(\w +)\s +(\d +)\s +(\S +)/ and defined ($DATE_LIST -> {$2 }) );
1950+ if ( $revision -> {modified } =~ / (\d +)\s +(\w +)\s +(\d +)\s +(\S +)/ and
1951+ defined ($DATE_LIST -> {$2 }) )
1952+ {
1953+ $revision -> {modified } = sprintf (' %04d/%02d/%02d %s' ,
1954+ $3 , $DATE_LIST -> {$2 }, $1 , $4 );
1955+ }
18621956 $revision -> {author } = cvs_author($revision -> {author });
1863- print " M date: $revision ->{modified}; author: $revision ->{author}; state: " . ( $revision -> {filehash } eq " deleted" ? " dead" : " Exp" ) . " ; lines: +2 -3\n " ;
1864- my $commitmessage = $updater -> commitmessage($revision -> {commithash });
1957+ print " M date: $revision ->{modified};" .
1958+ " author: $revision ->{author}; state: " .
1959+ ( $revision -> {filehash } eq " deleted" ? " dead" : " Exp" ) .
1960+ " ; lines: +2 -3\n " ;
1961+ my $commitmessage ;
1962+ $commitmessage = $updater -> commitmessage($revision -> {commithash });
18651963 $commitmessage =~ s / ^/ M / mg ;
18661964 print $commitmessage . " \n " ;
18671965 }
1868- print " M ============================================================================= \n " ;
1966+ print " M =======" . ( " = " x 70 ) . " \n " ;
18691967 }
18701968
18711969 print " ok\n " ;
0 commit comments