@@ -1559,75 +1559,128 @@ sub req_status
1559
1559
# $log->debug("status state : " . Dumper($state));
1560
1560
1561
1561
# 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 );
1563
1564
$updater -> update();
1564
1565
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 ...
1566
1568
argsfromdir($updater );
1567
1569
1568
1570
# foreach file specified on the command line ...
1569
1571
foreach my $filename ( @{$state -> {args }} )
1570
1572
{
1571
1573
$filename = filecleanup($filename );
1572
1574
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
+ }
1574
1580
1575
1581
my $meta = $updater -> getmeta($filename );
1576
1582
my $oldmeta = $meta ;
1577
1583
1578
1584
my $wrev = revparse($filename );
1579
1585
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.
1581
1588
if ( defined ($wrev ) and $wrev != $meta -> {revision } )
1582
1589
{
1583
1590
$oldmeta = $updater -> getmeta($filename , $wrev );
1584
1591
}
1585
1592
1586
1593
# TODO : All possible statuses aren't yet implemented
1587
1594
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
+ }
1615
1665
1616
1666
$status ||= " Unknown" ;
1617
1667
1618
1668
my ($filepart ) = filenamesplit($filename );
1619
1669
1620
- print " M =================================================================== \n " ;
1670
+ print " M =======" . ( " = " x 60 ) . " \n " ;
1621
1671
print " M File: $filepart \t Status: $status \n " ;
1622
1672
if ( defined ($state -> {entries }{$filename }{revision }) )
1623
1673
{
1624
- print " M Working revision:\t " . $state -> {entries }{$filename }{revision } . " \n " ;
1674
+ print " M Working revision:\t " .
1675
+ $state -> {entries }{$filename }{revision } . " \n " ;
1625
1676
} else {
1626
1677
print " M Working revision:\t No entry for $filename \n " ;
1627
1678
}
1628
1679
if ( defined ($meta -> {revision }) )
1629
1680
{
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 " ;
1631
1684
print " M Sticky Tag:\t\t (none)\n " ;
1632
1685
print " M Sticky Date:\t\t (none)\n " ;
1633
1686
print " M Sticky Options:\t\t (none)\n " ;
@@ -1661,13 +1714,17 @@ sub req_diff
1661
1714
$revision1 =~ s / ^1\. // if ( defined ( $revision1 ) );
1662
1715
$revision2 =~ s / ^1\. // if ( defined ( $revision2 ) );
1663
1716
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]" ) );
1665
1720
1666
1721
# 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 );
1668
1724
$updater -> update();
1669
1725
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 ...
1671
1728
argsfromdir($updater );
1672
1729
1673
1730
# foreach file specified on the command line ...
@@ -1722,7 +1779,8 @@ sub req_diff
1722
1779
$file2 = $state -> {entries }{$filename }{modified_filename };
1723
1780
}
1724
1781
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
1726
1784
if ( defined ( $revision1 ) and not defined ( $file2 ) )
1727
1785
{
1728
1786
( undef , $file2 ) = tempfile( DIR => $TEMP_DIR , OPEN => 0 );
@@ -1733,21 +1791,37 @@ sub req_diff
1733
1791
# We need to have retrieved something useful
1734
1792
next unless ( defined ( $meta1 ) );
1735
1793
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
+ }
1742
1806
1743
1807
# 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
+ }
1745
1813
1746
1814
print " M Index: $filename \n " ;
1747
- print " M =================================================================== \n " ;
1815
+ print " M =======" . ( " = " x 60 ) . " \n " ;
1748
1816
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
+ }
1751
1825
print " M diff " ;
1752
1826
foreach my $opt ( keys %{$state -> {opt }} )
1753
1827
{
@@ -1759,18 +1833,27 @@ sub req_diff
1759
1833
}
1760
1834
} else {
1761
1835
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
+ }
1763
1840
}
1764
1841
}
1765
1842
print " $filename \n " ;
1766
1843
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" ));
1768
1846
1769
1847
( $fh , $filediff ) = tempfile ( DIR => $TEMP_DIR );
1770
1848
1771
1849
if ( exists $state -> {opt }{u } )
1772
1850
{
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 " );
1774
1857
} else {
1775
1858
system (" diff $file1 $file2 > $filediff " );
1776
1859
}
@@ -1795,7 +1878,8 @@ sub req_log
1795
1878
# $log->debug("log state : " . Dumper($state));
1796
1879
1797
1880
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 .]+)?/ )
1799
1883
{
1800
1884
my $control = $2 ;
1801
1885
$minrev = $1 ;
@@ -1806,10 +1890,12 @@ sub req_log
1806
1890
}
1807
1891
1808
1892
# 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 );
1810
1895
$updater -> update();
1811
1896
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 ...
1813
1899
argsfromdir($updater );
1814
1900
1815
1901
# foreach file specified on the command line ...
@@ -1825,15 +1911,17 @@ sub req_log
1825
1911
if ( defined ( $minrev ) )
1826
1912
{
1827
1913
$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 )
1829
1916
{
1830
1917
pop @$revisions ;
1831
1918
}
1832
1919
}
1833
1920
if ( defined ( $maxrev ) )
1834
1921
{
1835
1922
$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 )
1837
1925
{
1838
1926
shift @$revisions ;
1839
1927
}
@@ -1850,22 +1938,32 @@ sub req_log
1850
1938
print " M access list:\n " ;
1851
1939
print " M symbolic names:\n " ;
1852
1940
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 " ;
1854
1943
print " M description:\n " ;
1855
1944
1856
1945
foreach my $revision ( @$revisions )
1857
1946
{
1858
1947
print " M ----------------------------\n " ;
1859
1948
print " M revision 1.$revision ->{revision}\n " ;
1860
1949
# 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
+ }
1862
1956
$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 });
1865
1963
$commitmessage =~ s / ^/ M / mg ;
1866
1964
print $commitmessage . " \n " ;
1867
1965
}
1868
- print " M ============================================================================= \n " ;
1966
+ print " M =======" . ( " = " x 70 ) . " \n " ;
1869
1967
}
1870
1968
1871
1969
print " ok\n " ;
0 commit comments