List Info

Thread: svn commit: r1806 - trunk/cvs2svn




svn commit: r1806 - trunk/cvs2svn
user name
2006-03-30 13:22:48
mhaggertigris.org writes:
> Log:
> Prepare to use a new object as the
cvs2svn_rcsparse.Sink in pass1.
>
> The CollectData class is used both to collect global
information about
> the CVS repository (e.g., database connections,
fatal_errors,
> num_files, etc.) and also as the cvs2svn_recparse.Sink
to receive
> information about individual files (e.g., branch_names,
file_in_attic,
> etc.).  This is currently accomplished by initializing
a bunch of
> file-specific variables in the set_fname() method that
are used in the
> parsing of one file then forgotten.
>
> I would like to rewrite this so that a new
FileDataCollector class is
> responsible for collecting the data for a particular
file, and
> CollectData creates instances of the new class as
needed.  The new
> class will have a reference to the CollectData object
so that it can
> write its information into the global databases.

+1 on the plan.  May I suggest that some of this log message
become
part of the documentation strings of the new class and of
CollectData,
when the time is right?

-K


> * cvs2svn (CollectData.get_file_data_collector): New
method.
>
>   (CollectData._set_fname): Method renamed from
set_fname().
>
>   (pass1.visit_file): Use get_file_data_collector()
method.
>
>
> Modified: trunk/cvs2svn
> Url: http://cvs2svn.tigris.
org/source/browse/cvs2svn/trunk/cvs2svn?view=diff&rev=18
06&p1=trunk/cvs2svn&p2=trunk/cvs2svn&r1=1805&
;r2=1806
>
============================================================
==================
> --- trunk/cvs2svn	(original)
> +++ trunk/cvs2svn	2006-03-30 07:57:30-0800
>  -1431,13 +1431,25 
>      # 1 if we've collected data for at least one
file, None otherwise.
>      self.found_valid_file = None
>  
> -    # See set_fname() for initializations of other
variables.
> +    # See _set_fname() for initializations of other
variables.
>  
> -  def set_fname(self, canonical_name, filename):
> +  def get_file_data_collector(self, canonical_name,
filename):
> +    """Return a
cvs2svn_rcsparse.Sink object that can be used to
> +    collect the data for FILENAME.  FILENAME is the
absolute
> +    filesystem path to the file in question, and
CANONICAL_NAME is
> +    FILENAME with the 'Attic' component removed (if
the file is indeed
> +    in the Attic).
> +
> +    For now we return self, prepared for the specified
file."""
> +
> +    self._set_fname(canonical_name, filename)
> +    return self
> +
> +  def _set_fname(self, canonical_name, filename):
>      """Prepare to receive data for
FILENAME.  FILENAME is the absolute
>      filesystem path to the file in question, and
CANONICAL_NAME is
>      FILENAME with the 'Attic' component removed (if
the file is indeed
> -    in the Attic) ."""
> +    in the Attic)."""
>      self.fname = canonical_name
>  
>      # We calculate and save some file metadata here,
where we can do
>  -4197,7 +4209,8 
>        pathname = os.path.join(dirname, fname)
>        if dirname.endswith(OS_SEP_PLUS_ATTIC):
>          # drop the 'Attic' portion from the pathname
for the canonical name.
> -        cd.set_fname(os.path.join(dirname[:-6],
fname), pathname)
> +        fdc =
cd.get_file_data_collector(os.path.join(dirname[:-6],
fname),
> +                                         pathname)
>        else:
>          # If this file also exists in the attic, it's
a fatal error
>          attic_path = os.path.join(dirname, 'Attic',
fname)
>  -4206,10 +4219,10 
>                  % (error_prefix, pathname, attic_path)
>            sys.stderr.write(err + '\n')
>            cd.fatal_errors.append(err)
> -        cd.set_fname(pathname, pathname)
> +        fdc = cd.get_file_data_collector(pathname,
pathname)
>        Log().write(LOG_NORMAL, pathname)
>        try:
> -        cvs2svn_rcsparse.parse(open(pathname, 'rb'),
cd)
> +        cvs2svn_rcsparse.parse(open(pathname, 'rb'),
fdc)
>        except (cvs2svn_rcsparse.common.RCSParseError,
ValueError,
>                RuntimeError):
>          err = "%s: '%s' is not a valid ,v
file" \

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribecvs2svn.tigris.org
For additional commands, e-mail: dev-helpcvs2svn.tigris.org

svn commit: r1806 - trunk/cvs2svn
user name
2006-03-31 09:30:13
kfogelcollab.net wrote:
> mhaggertigris.org writes:
>>I would like to rewrite this so that a new
FileDataCollector class is
>>responsible for collecting the data for a particular
file, and
>>CollectData creates instances of the new class as
needed.  The new
>>class will have a reference to the CollectData
object so that it can
>>write its information into the global databases.
> 
> +1 on the plan.  May I suggest that some of this log
message become
> part of the documentation strings of the new class and
of CollectData,
> when the time is right?

But of course.  It's in there now, and I updated
design-notes.txt, too.

Michael

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribecvs2svn.tigris.org
For additional commands, e-mail: dev-helpcvs2svn.tigris.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )