Update the tag database when a single source file is modified

View: New views
5 Messages — Rating Filter:   Alert me  

Update the tag database when a single source file is modified

by Shlomy Reinstein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Is there a way to ask Global to update its tag database when a source
file is modified? I created a tag database for my project, and when I
change a file in my editor, I'd like to tell Global to update the tag
database only for this file. I don't want Global to rescan the
project, or even the local directory, because I know that this is the
only modified file, so there is no reason to do more work.
If there is no way to do this in Global - can you tell me what type of
database it uses? Can I directly access this database using a library,
and do this update myself?
Thanks,
Shlomy


_______________________________________________
Help-global mailing list
Help-global@...
http://lists.gnu.org/mailman/listinfo/help-global

Re: Update the tag database when a single source file is modified

by Shigio YAMAGUCHI-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
> change a file in my editor, I'd like to tell Global to update the tag
> database only for this file. I don't want Global to rescan the
> project, or even the local directory, because I know that this is the
> only modified file, so there is no reason to do more work.

You can do it by the -u command of global(1).

$ vi file.c
$ global -u
$ _

If you want to know what has occurred, please add
the -v (verbose) option.
--
Shigio YAMAGUCHI <shigio@...>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3


_______________________________________________
Help-global mailing list
Help-global@...
http://lists.gnu.org/mailman/listinfo/help-global

Re: Update the tag database when a single source file is modified

by Shlomy Reinstein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Feb 25, 2009 at 10:42 AM, Shigio YAMAGUCHI <shigio@...> wrote:

> Hi,
>> change a file in my editor, I'd like to tell Global to update the tag
>> database only for this file. I don't want Global to rescan the
>> project, or even the local directory, because I know that this is the
>> only modified file, so there is no reason to do more work.
>
> You can do it by the -u command of global(1).
>
> $ vi file.c
> $ global -u
> $ _
>
> If you want to know what has occurred, please add
> the -v (verbose) option.
> --
> Shigio YAMAGUCHI <shigio@...>
> PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3
>

Correct me if I'm wrong, but "global -u" will scan the entire tree for
changes. Although it may skip the parsing of all unchanged files by
checking their timestamps, it will still scan the entire tree, when I
know up-front that only one file has changed and scanning the tree is
redundant (and takes a long time for a large tree). Is there a way to
tell Global (or gtags) to update just one specific file, and avoid
checking the entire tree?

Shlomy


_______________________________________________
Help-global mailing list
Help-global@...
http://lists.gnu.org/mailman/listinfo/help-global

Re: Update the tag database when a single source file is modified

by Shigio YAMAGUCHI-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Correct me if I'm wrong, but "global -u" will scan the entire tree for
> changes. Although it may skip the parsing of all unchanged files by
> checking their timestamps, it will still scan the entire tree, when I

Right.

> know up-front that only one file has changed and scanning the tree is
> redundant (and takes a long time for a large tree). Is there a way to
> tell Global (or gtags) to update just one specific file, and avoid
> checking the entire tree?

You can easily achieve it by changing gtags/gtags.c file especially in
incremental() function.
But it might be worthless. Though scanning tree seems to be redundant,
it does not so take time. It is updating database to spend a lot of time.

BSD Db library is not suitable for this usage. It is being examined to be
going to replace the database system with another one in the future.
--
Shigio YAMAGUCHI <shigio@...>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3


_______________________________________________
Help-global mailing list
Help-global@...
http://lists.gnu.org/mailman/listinfo/help-global

Re: Update the tag database when a single source file is modified

by Shlomy Reinstein :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> You can easily achieve it by changing gtags/gtags.c file especially in
> incremental() function.
> But it might be worthless. Though scanning tree seems to be redundant,
> it does not so take time. It is updating database to spend a lot of time.

Running "global -u" on my project tree, with NO changes in any of the
files, takes about 5 seconds. And I'm willing to run this each time I
save a file, which can be quite frequently.

> BSD Db library is not suitable for this usage. It is being examined to be
> going to replace the database system with another one in the future.
> --
> Shigio YAMAGUCHI <shigio@...>
> PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3
>

Thanks.

Shlomy


_______________________________________________
Help-global mailing list
Help-global@...
http://lists.gnu.org/mailman/listinfo/help-global