Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

dirstate.cpp: eliminate HgQueryDirstateDirectory and HgQueryDirstateFile

Changeset 24d1f530806f

Parent 470d229b7712

by Adrian Buehlmann

Changes to one file · Browse files at 24d1f530806f Showing diff from parent 470d229b7712 Diff from another changeset...

 
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
 
588
589
590
591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
593
594
595
596
597
598
 
599
600
601
 
515
516
517
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
519
520
 
560
561
562
 
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
 
 
 
 
 
 
578
579
580
581
@@ -515,34 +515,6 @@
 }     -static int HgQueryDirstateDirectory( - const std::string& hgroot, dirstate& ds, - const std::string& relpath, char& outStatus) -{ - Directory* dir = ds.root().getdir(relpath); - - if (!dir) - return 0; - - outStatus = dir->status(hgroot); -} - - -static int HgQueryDirstateFile( - dirstate& ds, const std::string& relpath, - const struct _stat& stat, char& outStatus) -{ - const direntry* e = ds.root().get(relpath); - - if (!e) - return 0; - - outStatus = e->status(stat); - - return outStatus != '?'; -} - -  int HgQueryDirstate(   const std::string& path, const char& filterStatus, char& outStatus)  { @@ -588,14 +560,22 @@
  relpath[i] = '/';   }   - int res = 0; + if (PathIsDirectory(path.c_str())) + { + Directory* dir = pds->root().getdir(relpath); + if (!dir) + return 0; + outStatus = dir->status(hgroot); + } + else + { + const direntry* e = pds->root().get(relpath); + if (!e) + return 0; + outStatus = e->status(stat); + }   - if (PathIsDirectory(path.c_str())) - res = HgQueryDirstateDirectory(hgroot, *pds, relpath, outStatus); - else - res = HgQueryDirstateFile(*pds, relpath, stat, outStatus); - - return res; + return 1;  }