Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New file format (testing appreciated) #522

Merged
merged 35 commits into from
Feb 19, 2021
Merged

New file format (testing appreciated) #522

merged 35 commits into from
Feb 19, 2021

Conversation

diegogangl
Copy link
Contributor

This is a branch for the new file format based on a spec from #279 with help from @johnnybubonic.
The spec is documented here: https://github.com/getting-things-gnome/gtg/blob/file_format_2/docs/contributors/file%20format.md

Testing super appreciated! GTG makes tons of backups, but this should still be as rock solid as possible.

closes #279

How to test:

Basically open GTG dev and play around. See if anything is saved incorrectly or there are any weird errors.
Another option is to use the import scripts from the scripts folder. You can import your tasks from GTG stable and test with them.

@nekohayo
Copy link
Member

On trying to launch with my personal dataset on the file_format_2 branch on my Ubuntu GTG smoke testing machine, while having previously launched it under master, I get this traceback preventing startup (and the process hangs there, you have to kill it):

2021-01-19 10:29:22,811 - DEBUG - application:set_debug_flag:580 - Debug output enabled.
2021-01-19 10:29:22,881 - DEBUG - __init__:__init__:58 - Backends found: ['backend_localfile', 'backend_signals']
2021-01-19 10:29:23,089 - WARNING - backend_localfile:this_is_the_first_run:147 - Found old file. Running versioning code.
Traceback (most recent call last):
  File "/home/user/gtg/.local_build/install/lib/python3.8/site-packages/GTG/gtk/application.py", line 95, in do_startup
    for backend_dic in BackendFactory().get_saved_backends_list():
  File "/home/user/gtg/.local_build/install/lib/python3.8/site-packages/GTG/backends/__init__.py", line 167, in get_saved_backends_list
    dic["backend"].this_is_the_first_run(None)
  File "/home/user/gtg/.local_build/install/lib/python3.8/site-packages/GTG/backends/backend_localfile.py", line 149, in this_is_the_first_run
    tree = versioning.convert(old_path, self.datastore)
AttributeError: 'Backend' object has no attribute 'datastore'
Traceback (most recent call last):
  File "/home/user/gtg/.local_build/install/lib/python3.8/site-packages/GTG/gtk/application.py", line 122, in do_activate
    self.init_shared()
  File "/home/user/gtg/.local_build/install/lib/python3.8/site-packages/GTG/gtk/application.py", line 158, in init_shared
    self.init_browser()
  File "/home/user/gtg/.local_build/install/lib/python3.8/site-packages/GTG/gtk/application.py", line 166, in init_browser
    self.browser = MainWindow(self.req, self)
  File "/home/user/gtg/.local_build/install/lib/python3.8/site-packages/GTG/gtk/browser/main_window.py", line 69, in __init__
    self.config = self.req.get_config('browser')
AttributeError: 'NoneType' object has no attribute 'get_config'

@diegogangl
Copy link
Contributor Author

Can't replicate. Maybe it's a race condition (register_datastore() hasn't been called yet)?

@Neui
Copy link
Contributor

Neui commented Jan 25, 2021

I was able to reproduce. Looking at it, self.datastore is not set. This is set by GenericBackend.register_datastore which is called part of the TaskSource.__init__, which is only constructed in DataStore.register_backend, which is only called in Application.do_startup inside the loop. However, this_is_the_first_run is only called inside the BackendFactory.get_saved_backends_list, which is called before that loop body runs.

In my case, the loop before calling this_is_the_first_run (for backend in config.get_all_backends():), config.get_all_backends() returns nothing since the backends.conf config file either doesn't exists or is is empty.

I don't know how it would work for you.

@diegogangl
Copy link
Contributor Author

Deleting backends.conf and gtg_data.xml (if present) triggers the bug

@diegogangl
Copy link
Contributor Author

Pushed a fix for that bug

@nekohayo
Copy link
Member

Now it launches, but with my personal data set (anonymized version) auto-imported/converted by your implementation:

  • Tags and subtasks are not shown at all inside the task editor, only the title and description are shown
  • The tasks/subtasks hierarchy is completely gone from the task browser's list of tasks, for any given tag
  • projects.xml is somehow not updated to point to the new gtg_data.xml file but still works? Is this branch doing away entirely with the notion of projects (aka profiles), which may have been interesting for the future?

@diegogangl
Copy link
Contributor Author

projects.xml is somehow not updated to point to the new gtg_data.xml file but still works? Is this branch doing away entirely with the notion of projects (aka profiles), which may have been interesting for the future?

This was mentioned in #279. We don't really need another xml file since everything is inside gtg_data.xml. You can have different profiles by loading different xml files directly.

And fix some broken ones from the rebase
Following the spec and XML data types
Sometimes the first run task can be called before initialization.
If versioning isn't called then, it can create a new empty file instead.
This avoids a freeze when backends.conf is empty or doesn't exist.
We need to call this_is_first_run() *after* the datastore has been set in
the backend
We moved to emojis earlier than anticipated, so there's no need to keep the old
icons around.

fixes #540
This used to be only for @-style IDs, but we have to do it for the older
IDs too. Otherwise GTG can't connect subtasks to their parents (since
they are using UUIDs)
CDATA takes about everything but that combination of characters, so we need to
encode them.
@tkdchen
Copy link
Contributor

tkdchen commented Feb 21, 2021

Synced the code and the latest one on master branch is fa7b34a.

After ./launch.sh, the gtg dialog is empty. My tasks are still available in tmp/default/xdg/data/gtg/gtg_tasks.xml.

Do I have to run scripts/import_my_tasks_into_debug_tasks.sh to import the data into the new format?

I gave a try to run the script and got:

Running the development/debug version - using separate user directories
Your data is in the 'tmp' subdirectory with the 'default' dataset.
-----------------------------------------------------------------------
cp: cannot stat '/home/chen/.local/share/gtg/*': No such file or directory
cp: cannot stat '/home/chen/.config/gtg/*': No such file or directory

What prerequisite is required to run the script?

@morhe-blip
Copy link
Contributor

Confirmed in #565

If you work with the dev version (as I do), the script should not work, because there is no data .local/ folder.
This folder is used for the 'regular' version of GTG.

@WhilelM
Copy link

WhilelM commented Feb 28, 2021

Same problem that @tkdchen
Synced the code and the latest one on master branch is 4a608d2
After ./launch.sh, the gtg dialog is empty. My tasks are still available in tmp/default/xdg/data/gtg/f4cf1957-8b10-4562-917b-812e5e170377.xml

I could work with my data when checkout commit 5442868

@diegogangl
Copy link
Contributor Author

@WhilelM is this data from older versions of GTG (0.3 and earlier)? Could you try renaming that file to gtg_tasks.xml?

@WhilelM
Copy link

WhilelM commented Mar 1, 2021

@WhilelM is this data from older versions of GTG (0.3 and earlier)? Could you try renaming that file to gtg_tasks.xml?

I have backup from 2013 and I use debian, so I think so.
I tried git checkout master and copied in a new file cp tmp/default/xdg/data/gtg/f4cf1957-8b10-4562-917b-812e5e170377.xml tmp/default/xdg/data/gtg/gtg_tasks.xml. no more success =/

@diegogangl diegogangl deleted the file_format_2 branch March 2, 2021 21:55
@WhilelM
Copy link

WhilelM commented Mar 22, 2021

How can I convert my data to new format ?

@diegogangl
Copy link
Contributor Author

HI @WhilelM, it should convert automatically. Try using master, not this branch though.

@WhilelM
Copy link

WhilelM commented Dec 31, 2021

I still have issue with my data. I'm stucked with commit 5442868 and can't load any task if I use anything less older.
How gtg would convert it automatically ?

@diegogangl
Copy link
Contributor Author

That's weird, there's no change in the file format there or in any recent commit. Are you getting any errors in the terminal?

@nekohayo nekohayo added the maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers priority:critical
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better XML format [RFC]
6 participants