[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: Review Request: Use the KVersionControlPlugin for the next highest folder not the first one that
From:       "Frank Reininghaus" <frank78ac () googlemail ! com>
Date:       2012-10-28 16:58:45
Message-ID: 20121028165845.19609.77517 () vidsolbach ! de
[Download RAW message or body]

> On Oct. 27, 2012, 1:38 p.m., Frank Reininghaus wrote:
> > Thanks for the patch! Good catch, I wasn't aware of this problem.
> > 
> > Looks good, I'm just wondering if we could maybe do it in a slightly simpler way, \
> > without the new function: Maybe one could move the code starting with "// Version \
> > control systems..." out of the foreach-loop, then replace "while (upUrl != \
> > dirUrl)" by "if (upUrl != dirUrl)" and have the function call itself recursively \
> > if that is the case?
> 
> Dominik Schmidt wrote:
> Of course we could squeeze it all into one big function, but I'd find it way harder \
> to read - just matter of taste.  
> Also I'm not exactly sure how/what the static locals are meant to work/do and I'd \
> be afraid to break stuff when changing too much and recursively calling that \
> function ;-)

With my suggestion, the modified function VersionControlObserver::searchPlugin() \
would actually be *shorter* than it is now, so I don't think that this approach can \
be called "squeezing it all into one big function" ;-) And why that would be "way \
harder to read" is also not clear to me.

An alternative to using recursion would be to still move the entire "upUrl" stuff out \
of the foreach-loop, and put the search for "fileName" into a new foreach-loop that \
iterates over the plugins. But the recursive solution requires less code, and that \
makes the code easier to read IMHO.

Static locals keep their values between calls of the function. They are initialised \
the first time the function is called, and subsequent calls are faster because the \
expensive search for the plugins is not needed any more.


- Frank


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107066/#review21003
-----------------------------------------------------------


On Oct. 26, 2012, 11:52 p.m., Dominik Schmidt wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107066/
> -----------------------------------------------------------
> 
> (Updated Oct. 26, 2012, 11:52 p.m.)
> 
> 
> Review request for Dolphin.
> 
> 
> Description
> -------
> 
> Sorry, for the confusing summary, couldn't describe it better in one sentence, \
> suggestions for a commit message are very much appreciated. 
> 
> The current behaviour of dolphin is:
> if for the first plugin in the list of loaded plugins the fileName is not found in \
> the current directory, it looks in the directory above, if it's not found there it \
> looks in the directory above and so on - all with the same plugin. This leads to a \
> problematic situation with for example Dropbox. Dropbox-Sync folders are identified \
> by the .dropbox folder in their top-level. but also there is a ~/.dropbox. So when \
> you enable the dolphin-box-plugin, basically no other KVersionControlPlugin will be \
> able to work. It will go up to your home and think everything inside it is tracked \
> by Dropbox. 
> This patch makes dolphin check all plugins for the current directory, then go one \
> directory up, check all plugins again, go one up etc..  
> 
> P.S.: Is there any better/more flexible API to use for sync-plugins? 
> 
> 
> Diffs
> -----
> 
> dolphin/src/views/versioncontrol/versioncontrolobserver.h 501af7d 
> dolphin/src/views/versioncontrol/versioncontrolobserver.cpp 42e00de 
> 
> Diff: http://git.reviewboard.kde.org/r/107066/diff/
> 
> 
> Testing
> -------
> 
> I can use other plugins simultaneously with the Dropbox one now... 
> 
> 
> Thanks,
> 
> Dominik Schmidt
> 
> 


[Attachment #3 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/107066/">http://git.reviewboard.kde.org/r/107066/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On October 27th, 2012, 1:38 p.m., <b>Frank \
Reininghaus</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px \
solid #d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Thanks for the patch! Good catch, I wasn&#39;t aware of this problem.

Looks good, I&#39;m just wondering if we could maybe do it in a slightly simpler way, \
without the new function: Maybe one could move the code starting with &quot;// \
Version control systems...&quot; out of the foreach-loop, then replace &quot;while \
(upUrl != dirUrl)&quot; by &quot;if (upUrl != dirUrl)&quot; and have the function \
call itself recursively if that is the case?</pre>  </blockquote>




 <p>On October 28th, 2012, 10:16 a.m., <b>Dominik Schmidt</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Of course we could \
squeeze it all into one big function, but I&#39;d find it way harder to read - just \
matter of taste. 

Also I&#39;m not exactly sure how/what the static locals are meant to work/do and \
I&#39;d be afraid to break stuff when changing too much and recursively calling that \
function ;-)</pre>  </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">With my suggestion, the \
modified function VersionControlObserver::searchPlugin() would actually be *shorter* \
than it is now, so I don&#39;t think that this approach can be called &quot;squeezing \
it all into one big function&quot; ;-) And why that would be &quot;way harder to \
read&quot; is also not clear to me.

An alternative to using recursion would be to still move the entire &quot;upUrl&quot; \
stuff out of the foreach-loop, and put the search for &quot;fileName&quot; into a new \
foreach-loop that iterates over the plugins. But the recursive solution requires less \
code, and that makes the code easier to read IMHO.

Static locals keep their values between calls of the function. They are initialised \
the first time the function is called, and subsequent calls are faster because the \
expensive search for the plugins is not needed any more.</pre> <br />








<p>- Frank</p>


<br />
<p>On October 26th, 2012, 11:52 p.m., Dominik Schmidt wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Dolphin.</div>
<div>By Dominik Schmidt.</div>


<p style="color: grey;"><i>Updated Oct. 26, 2012, 11:52 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Sorry, for the confusing summary, couldn&#39;t describe it better in one \
sentence, suggestions for a commit message are very much appreciated.


The current behaviour of dolphin is:
if for the first plugin in the list of loaded plugins the fileName is not found in \
the current directory, it looks in the directory above, if it&#39;s not found there \
it looks in the directory above and so on - all with the same plugin. This leads to a \
problematic situation with for example Dropbox. Dropbox-Sync folders are identified \
by the .dropbox folder in their top-level. but also there is a ~/.dropbox. So when \
you enable the dolphin-box-plugin, basically no other KVersionControlPlugin will be \
able to work. It will go up to your home and think everything inside it is tracked by \
Dropbox.

This patch makes dolphin check all plugins for the current directory, then go one \
directory up, check all plugins again, go one up etc.. 



P.S.: Is there any better/more flexible API to use for sync-plugins? </pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">I can use other plugins simultaneously with the Dropbox one now... \
</pre>  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>dolphin/src/views/versioncontrol/versioncontrolobserver.h <span style="color: \
grey">(501af7d)</span></li>

 <li>dolphin/src/views/versioncontrol/versioncontrolobserver.cpp <span style="color: \
grey">(42e00de)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/107066/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic