[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] [cvs2svn] Code cleanup - Use "for: ... else: ..." to avoid a temporary variable

From: mark benedetto king <mbk_at_lowlatency.com>
Date: 2003-08-23 14:49:28 CEST

On Sat, Aug 23, 2003 at 11:43:22AM +0100, Max Bowsher wrote:
> * tools/cvs2svn/cvs2svn.py (SymbolicNameTracker.bump_rev_count):
> Use "for: ... else: ..." construct to render temporary variable
> unnecessary.
>
> Index: cvs2svn.py
> ===================================================================
> --- cvs2svn.py (revision 6839)
> +++ cvs2svn.py (working copy)
> @@ -1310,20 +1310,17 @@
> entry_val[revlist_key] = [(rev, 1)]
> else:
> rev_counts = entry_val[revlist_key]
> - done = None
> for i in range(len(rev_counts)):
> this_rev, this_count = rev_counts[i]
> if rev == this_rev:
> rev_counts[i] = (this_rev, this_count + 1)
> - done = 1
> break
> elif this_rev > rev:
> if i > 0:
> i = i - 1
> rev_counts.insert(i, (rev, 1))
> - done = 1
> break
> - if not done:
> + else:
> rev_counts.append((rev, 1))
> entry_val[revlist_key] = rev_counts
>

Doesn't this change the semantics of the block?

For example, what if rev_counts contains only pairs of the form (x,y)
where x < rev?

--ben

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Aug 23 14:48:06 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.