You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2003/08/01 19:48:36 UTC

Re: [PATCH]: status "I" not consistently shown for ignored directory

Should I commit this or does it need more work?

- Julian


Julian Foad wrote:
> New version of patch.
> 
> I have factored out the duplicated code into a local function, removed 
> an unnecessary comment and name change from the test script, and fixed 
> the log message.
> 
> Log message:
> [[[
> Fix status indicator "I": when an ignored directory was given as an explicit
> argument, its status was reported as "?".
> 
> * subversion/libsvn_wc/status.c
>  (add_unversioned_path) New function factored out of svn_wc_statuses.
>  (svn_wc_statuses) Call add_unversioned_path once where I factored it out,
>    and once instead of add_status_structure to report the status of an
>    explicitly requested unversioned directory.
>  (add_unversioned_item) Fix argument names in the comment.
> 
> * subversion/tests/clients/cmdline/stat_tests.py
>  (status_for_unignored_file) Test a directory as well as a file. Simplify
>    the code by using "run_and_verify_svn".
> ]]]
> 
> - Julian
> 
> 
> ------------------------------------------------------------------------
> 
> Index: subversion/libsvn_wc/status.c
> ===================================================================
> --- subversion/libsvn_wc/status.c	(revision 6599)
> +++ subversion/libsvn_wc/status.c	(working copy)
> @@ -410,18 +410,18 @@
>  } 
>  
>  
> -/* Add a status_structure for BASENAME to the STATUSHASH, assuming 
> +/* Add a status structure for NAME to the STATUSHASH, assuming 
>     that the file is unversioned.  This function should never
>     be called on a versioned entry. 
>  
>     NAME is the basename of the unversioned file whose status is being 
>     requested. 
>  
> -   PATH_KIND is the node kind of PATH as determined by the caller.
> +   PATH_KIND is the node kind of NAME as determined by the caller.
>  
>     STATUSHASH is a mapping from path to status structure.  On entry, it 
>     may or may not contain status structures for other paths.  Upon return
> -   it may contain a status structure for BASENAME.
> +   it may contain a status structure for NAME.
>  
>     ADM_ACCESS is an access baton for the working copy path. 
>  
> @@ -432,7 +432,7 @@
>  
>     If NO_IGNORE is non-zero, the item will be added regardless of whether 
>     it is ignored; otherwise we will only add the item if it does not 
> -   match any of the patterns in IGNORES.
> +   match any of the patterns in PATTERNS.
>     
>     If a status structure for the item is added, NOTIFY_FUNC will called 
>     with the path of the item and the NOTIFY_BATON.  NOTIFY_FUNC may be 
> @@ -479,6 +479,36 @@
>    return SVN_NO_ERROR;
>  }
>  
> +/* Add an unversioned item PATH to the given STATUSHASH.
> +   This is a convenience wrapper around add_unversioned_item and takes the
> +   same parameters except:
> +   PATH is the full path; only its base name will be used.
> +   DEFAULT_IGNORES will have local ignores added to it.
> +   It is assumed that the item is not to be ignored.
> +*/
> +static svn_error_t *
> +add_unversioned_path (const char *path,
> +                      svn_node_kind_t path_kind,
> +                      apr_hash_t *statushash,
> +                      svn_wc_adm_access_t *adm_access,
> +                      apr_array_header_t *default_ignores,
> +                      svn_wc_notify_func_t notify_func,
> +                      void *notify_baton,
> +                      apr_pool_t *pool)
> +{
> +  char *name;
> +  apr_array_header_t *patterns;
> +
> +  patterns = apr_array_make (pool, 1, sizeof(const char *));
> +  SVN_ERR (collect_ignore_patterns (patterns, default_ignores, adm_access,
> +                                    pool));
> +
> +  name = svn_path_basename (path, pool);
> +  return add_unversioned_item (name, path_kind, statushash, adm_access,
> +                               patterns, TRUE, notify_func, notify_baton,
> +                               pool);
> +}
> +
>  /* Add all items that are NOT in ENTRIES (which is a list of PATH's
>     versioned things) to the STATUSHASH as unversioned items,
>  
> @@ -795,19 +825,9 @@
>           we're ignoring the GET_ALL flag and unconditionally fetching
>           the status structure. */
>        if (!entry) 
> -        {
> -          char *name;
> -          apr_array_header_t *patterns;
> -
> -          patterns = apr_array_make (pool, 1, sizeof(const char *));
> -          SVN_ERR (collect_ignore_patterns (patterns, ignores, 
> -                                            adm_access, pool));
> -
> -          name = svn_path_basename (path, pool);
> -          SVN_ERR (add_unversioned_item (name, kind, statushash, 
> -                                         adm_access, patterns, TRUE, 
> -                                         notify_func, notify_baton, pool));
> -        }
> +        SVN_ERR (add_unversioned_path (path, kind, statushash, adm_access,
> +                                       ignores, notify_func, notify_baton,
> +                                       pool));
>        else
>          {
>            SVN_ERR (svn_wc_entry (&parent_entry,
> @@ -831,9 +851,8 @@
>        /* A wc format of 0 means this directory is not being versioned
>           at all (not by Subversion, anyway). */
>        if (wc_format_version == 0)
> -        return add_status_structure
> -          (statushash, path, NULL, NULL, NULL,
> -           svn_node_dir, FALSE, FALSE, notify_func, notify_baton, pool);
> +        return add_unversioned_path (path, kind, statushash, adm_access,
> +                                     ignores, notify_func, notify_baton, pool);
>  
>        SVN_ERR (svn_wc_is_wc_root (&is_root, path, adm_access, pool));
>        if (! is_root)
> Index: subversion/tests/clients/cmdline/stat_tests.py
> ===================================================================
> --- subversion/tests/clients/cmdline/stat_tests.py	(revision 6599)
> +++ subversion/tests/clients/cmdline/stat_tests.py	(working copy)
> @@ -318,7 +318,7 @@
>  
>  
>  def status_for_unignored_file(sbox):
> -  "status for unignored file"
> +  "status for unignored file and directory"
>  
>    sbox.build()
>  
> @@ -329,33 +329,23 @@
>  
>    try:
>      svntest.main.file_append('newfile', 'this is a new file')
> -    svntest.main.run_svn(None, 'propset', 'svn:ignore', 'newfile', '.')
> +    os.makedirs('newdir')
> +    svntest.main.run_svn(None, 'propset', 'svn:ignore', 'new*', '.')
>  
>      # status on the directory with --no-ignore
> -    stat_output, err_output = svntest.main.run_svn(None, 'status', 
> -                                                   '--no-ignore', '.')
> -    if err_output:
> -      raise svntest.Failure
> -    status = 1
> -    for line in stat_output:
> -      if re.match("I +newfile", line):
> -        status = 0
> +    svntest.actions.run_and_verify_svn(None,
> +                                       [' M     .\n',
> +                                        'I      newdir\n',
> +                                        'I      newfile\n'],
> +                                       [],
> +                                       'status', '--no-ignore', '.')
>  
> -    if (status == 1):
> -      raise svntest.Failure
> -
>      # status specifying the file explicitly on the command line
> -    stat_output, err_output = svntest.main.run_svn(None, 'status', 'newfile')
> -
> -    if err_output:
> -      raise svntest.Failure
> -    status = 1
> -    for line in stat_output:
> -      if re.match("I +newfile", line):
> -        status = 0
> -
> -    if (status == 1):
> -      raise svntest.Failure
> +    svntest.actions.run_and_verify_svn(None,
> +                                       ['I      newdir\n',
> +                                        'I      newfile\n'],
> +                                       [],
> +                                       'status', 'newdir', 'newfile')
>    
>    finally:
>      os.chdir(was_cwd)
> 
> 
> 
> ------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]: status "I" not consistently shown for ignored directory

Posted by Julian Foad <ju...@btopenworld.com>.
Philip Martin wrote:
> Julian Foad <ju...@btopenworld.com> writes:
> 
>>Should I commit this or does it need more work?
> 
> It looks reasonable, commit it.

Thanks.  Committed in r6637.

- Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]: status "I" not consistently shown for ignored directory

Posted by Philip Martin <ph...@codematters.co.uk>.
Julian Foad <ju...@btopenworld.com> writes:

> Should I commit this or does it need more work?

It looks reasonable, commit it.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org