How to purge a single checkin of the current branch in fossil? - fossil

I am using fossil for some kind of incremential backup database. So far it works very well, except purging old entries.
As this is all automated and meant to be simple all checkins/rollbacks work on the trunk.
Now I tried to add the option to purge old checkins, but I am not able to, always running into the error message:
cannot purge the current checkout
Perhaps I am using purge in a wrong way, though i wasn't able to find how to do it correctly.
Currently i add a tag to the checkins i want to remove, and try to purge them which doesn't work. Removing the trunk tag from those checkins makes no difference. Running purge while my local repository is closed is not possible as fossil requires the vvar table for this operation.
I did an example to illustrate:
D:\_tmp\repo>fossil init test
project-id: d16c0c72d95305884776f5c6e4d440ec687511a3
server-id: 1de96e7234a3e2b6561a31ad0cb9d55243be0bdb
admin-user: usr (initial password is "9dd6fb")
D:\_tmp\repo>fossil open test
project-name: <unnamed>
repository: D:/_tmp/repo/test
local-root: D:/_tmp/repo/
config-db: C:/Users/usr/AppData/Local/_fossil
project-code: d16c0c72d95305884776f5c6e4d440ec687511a3
checkout: 48edad6b8a3a946ad92b96bc41a2911ee709d6b5 2015-08-20 12:54:17 UTC
leaf: open
tags: trunk
comment: initial empty check-in (user: usr)
check-ins: 1
D:\_tmp\repo>fossil addremove
ADDED closedpurge.txt
added 1 files, deleted 0 files
D:\_tmp\repo>fossil commit -m auto
./closedpurge.txt contains CR/NL line endings. Use --no-warnings or the "crnl-gl
ob" setting to disable this warning.
Commit anyhow (a=all/c=convert/y/N)? a
New_Version: 3ffebd89c0d7e8ac92a21f3a0085568c39e113ea
D:\_tmp\repo>fossil addremove
DELETED closedpurge.txt
added 0 files, deleted 1 files
D:\_tmp\repo>fossil commit -m auto
New_Version: be0ac15264616ce86f0fce0b8a2de05c80ea3e0b
D:\_tmp\repo>fossil timeline
=== 2015-08-20 ===
12:55:05 [be0ac15264] *CURRENT* auto (user: usr tags: trunk)
12:54:47 [3ffebd89c0] auto (user: usr tags: trunk)
12:54:17 [48edad6b8a] initial empty check-in (user: usr tags: trunk)
+++ no more data (3) +++
D:\_tmp\repo>fossil tag add topurge 3ffebd89c0
D:\_tmp\repo>fossil timeline
=== 2015-08-20 ===
12:56:37 [98c3a4f991] Edit [3ffebd89c0d7e8ac|3ffebd89c0]: Add tag "topurge".
(user: usr)
12:55:05 [be0ac15264] *CURRENT* auto (user: usr tags: trunk)
12:54:47 [3ffebd89c0] auto (user: usr tags: trunk, topurge)
12:54:17 [48edad6b8a] initial empty check-in (user: usr tags: trunk)
+++ no more data (4) +++
D:\_tmp\repo>fossil purge topurge
cannot purge the current checkout
D:\_tmp\repo>fossil tag cancel trunk 3ffebd89c0
D:\_tmp\repo>fossil timeline
=== 2015-08-20 ===
12:57:30 [21885761c2] Edit [3ffebd89c0d7e8ac|3ffebd89c0]: Cancel tag "trunk".
(user: usr)
12:56:37 [98c3a4f991] Edit [3ffebd89c0d7e8ac|3ffebd89c0]: Add tag "topurge".
(user: usr)
12:55:05 [be0ac15264] *CURRENT* auto (user: usr)
12:54:47 [3ffebd89c0] auto (user: usr tags: topurge)
12:54:17 [48edad6b8a] initial empty check-in (user: usr tags: trunk)
+++ no more data (5) +++
D:\_tmp\repo>fossil purge topurge
cannot purge the current checkout
D:\_tmp\repo>fossil close
D:\_tmp\repo>fossil purge topurge -R test
SQLITE_ERROR: no such table: vvar
fossil: no such table: vvar
SELECT value FROM vvar WHERE name='checkout'
All i did was initializing a new fossil repository; add a single file and commit; rmeove the file and commit again; and try to purge the check in which added the file.
Edit: I tested this using fossil version 1.32 and 1.33

The error message appears to say it all, really: you can't purge the current checkout (which is the checkin marked as *CURRENT* in the timeline), or one of its descendants. From the help for the purge command (emphasis mine):
Move the check-ins identified by TAGS and all of their descendants
out of the repository (…)
The solution is to update or checkout to a different checkin that doesn't depend on the checkin to purge before doing the purge.

Related

How can I load only changed data in PowerBI?

I have weekly user login data for a program. I need to set up my query to only append rows for the people who logged in this week. The query is pulled from a folder containing each week's export in a separate csv file.
Example of files with pull date, user name, and last login:
Pull date: 2019-08-09
Mufasa 08-08
Simba 08-08
Nala 08-07
Timon 07-15
Pumba 06-03
Pull date: 2019-08-16
Mufasa 08-14
Simba 08-13
Nala 08-12
Timon 07-15
Pumba 06-03
Pull date: 2019-08-23
Mufasa 08-23
Simba 08-13
Nala 08-12
Timon 07-15
Pumba 06-03
What I want to see in PowerBI is this:
Mufasa 08-08
Mufasa 08-14
Mufasa 08-23
Simba 08-08
Simba 08-13
Nala 08-07
Nala 08-12
Timon 07-15
Pumba 06-03
I don't think I want incremental refresh, but I'm willing to learn more. I want my appended query to only have the data indicated, not just an abbreviated refresh. I may be misunderstanding how incremental refresh works, though.
Would a parameter on last login work, and if so, how would I set that up?

Hugo site isn't starting locally

I'm currently trying to build a Hugo site locally, and no content is showing. I'd love more trouble-shooting steps or anything that can help me do a clean rebuild so I don't have to transfer all my posts over to a Google site.
I've tried re-instantiating the site, rebuilding it with hugo, starting the server with hugo server and hugo server -D, but I'm only getting a blank screen.
I have pages that aren't drafts, so something should definitely be showing. It's possible the public or index folder are goofed, but I'm not sure.
hugo version: Hugo Static Site Generator v0.48/extended darwin/amd64
go version: go version go1.11.2 darwin/amd64
config.toml:
baseURL = ""
languageCode = "en-us"
title = ""
theme = "ananke"
[menu]
[[menu.main]]
identifier = "Posts"
name = "Posts"
pre = "<i class='fa fa-road'></i>"
url = "/posts/"
weight = -100
[params]
featured_image = "images/space-cat-wallpaper.jpg"
twitter = ""
When building the pages with hugo:
| EN
+------------------+----+
Pages | 72
Paginator pages | 0
Non-page files | 0
Static files | 21
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 88 ms
When starting the local instance with hugo server -D:
| EN
+------------------+-----+
Pages | 117
Paginator pages | 5
Non-page files | 0
Static files | 21
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 120 ms
Watching for changes in /Users/jschalz/Desktop/hugo-jschalz.github.io-2/{content,data,layouts,static,themes}
Watching for config changes in /Users/jschalz/Desktop/hugo-jschalz.github.io-2/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
After running hugo -v --debug -D I get the following warnings and then a LOT of debug noise:
WARN 2019/06/16 16:33:21 No translation bundle found for default language "en"
WARN 2019/06/16 16:33:21 Translation func for language en not found, use default.
WARN 2019/06/16 16:33:21 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.
Navigating to localhost:1313 gives me a blank screen.
First hugo -v --debug -D could tell you more
Second, to be really sure something is generated, try:
hugo server --renderToDisk --gc --cleanDestinationDir
Check that files are created (as opposed to be served in memory)
Note: I always prefer adding in my config.toml
builddrafts = true
It is useful when starting a project, to be sure everything is generated.
The OP ladygremlin confirms in the comments:
I think the builddrafts = true in the config.toml fixed it!
I also upgraded to the newest version of hugo.

How to print initial letter of committer in git log?

I have prepared an alias to get a short log report in git
# excerpt from ~/.gitconfig
[alias]
lg = log --all --oneline --graph --decorate --pretty='%C(auto)%h %Cgreen%ai %C(reset)%C(auto)%s %d'
git lg generates one nice line per commit, but without information on the user:
* 623beff 2016-11-14 14:18:36 +0100 extended plotstyle option and automatic colors
or as screenshot:
But I want to see the initial letters of the committer real name (the full name is sometimes too long) in each line:
* 623beff 2016-11-14 14:18:36 +0100 (J.S.) extended plotstyle option and automatic colors
How can I get this result?
there is a way to do this to get the first letter of the first name, using %<(3,trunc)%cN:
git log --all --oneline --graph --decorate --pretty='%C(auto)%h %Cgreen%ai %C(reset)%C(auto)(%<(3,trunc)%cN) %s %d'
output:
* 8759307 2009-01-15 16:11:48 +0000 (S..) Remove spurious code trying to tag a branch root before the mark was created. (HEAD -> master, origin/master, origin/HEAD)
* 939f999 2008-12-11 13:41:37 +0000 (S..) When just writing output file, do not try to devise lock target with no repository.

Git: Getting commits with a ticket number

Okay, so I'm trying to find out if a ticket has been included in my release branch. The tickets are all built out of a project id and an id number, e.g. (PRO-123). I've tried this command:
git log --date=short --format="%h: %ad (%cn) %s" --abbrev-commit --grep='[A-Z]+-[0-9]+'
But it's not returning anything. If I take away the --grep part there's loads of matches to the pattern. For instance:
a6fdcd0: 2016-03-16 (ajfaraday) Merge remote-tracking branch 'origin/develop_5.2_customer' into release_5.2_customer
85d107a: 2016-03-16 (username) Merge pull request #477 from myapp/fix_CST-827_outline_method_in_use_check
6024bda: 2016-03-16 (Andrew Faraday) Merge pull request #473 from myapp/fix_CST-810_soap_container_create_bounds
eec2a61: 2016-03-16 (ajfaraday) added missing stubs
c03b3cb: 2016-03-15 (username) Merge pull request #472 from myapp/fix_CST-490_options_are_clickable_for_user_without_module_admin_rights
728539b: 2016-03-15 (username) Merge pull request #474 from myapp/fix_CST-873_hidden_error_on_pev_validation
4a11dd7: 2016-03-15 (username) Merge pull request #475 from myapp/fix_CST-854_copy_process_version_project_element_values
4a5af44: 2016-03-15 (ajfaraday) CST-854: fixed in-use check for methods
What am I doing wrong?
Okay, I think I've found the problem. It's some minor language difference in regexes (I'm usually writing them in my Ruby code).
For some reason [A-Z]+ wasn't matching but [A-Z]* is working fine. This line does what I wanted:
git log --date=short --format="%h: %ad (%cn) %s" --abbrev-commit --grep="[A-Z]*-[0-9]*"

With Rails 4 and selenium web driver, use Sauce Labs on Travis CI but not locally

I'm filling out specs for an open source Rails project and need to run the app in a browser for some of my feature specs. I'd like to use Sauce Labs on Travis CI, but without having to rewrite my specs to also use Sauce Labs locally, because:
I don't want to have to be connected to the Internet during development to run my specs.
Making the specs reliant on Sauce Labs would make it impossible for contributors to run the specs themselves without setting up their own Sauce Labs account and env vars.
I couldn't find documentation detailing this scenario. What's the best way of achieving this?
For those with similar needs, this is what I ended up doing:
.travis.yml:
env:
global:
- secure: "encrypted sauce username"
- secure: "encrypted sauce secret key"
addons:
sauce_connect: true
before_install:
# install the ed text editor which we use to append
# file contents to a specific line of another file
- sudo apt-get install -y ed
# appends contents of travis/Gemfile.travis to Gemfile
- cat travis/Gemfile.travis >> Gemfile
# adds contents of travis/rails_helper.rb.travis to line 12 of spec/rails_helper.rb
- ed -s spec/rails_helper.rb <<< '12r travis/rails_helper.rb.travis'$'\nw'
travis/Gemfile.travis:
group :test, :development do
gem 'sauce', '~> 3.1.1'
gem 'sauce-connect'
gem 'parallel_tests'
end
travis/rails_helper.rb.travis:
require 'sauce'
require 'sauce/capybara'
# change to "Capybara.default_driver = :sauce" to use sauce
# for ALL feature specs, not just ones marked with "js: true"
Capybara.javascript_driver = :sauce
Sauce.config do |config|
config[:browsers] = [
['Linux', 'Chrome', nil],
# and other OS/browser combos you want to support...
]
end
UPDATE (2014/11/25):
I ended up using a slightly different configuration in my final solution. I didn't like the brittleness of inserting at a line number. Instead of having special Sauce inclusions in separate files, I just nested special configuration in a conditional, depending on whether an environment variable SAUCY is set to true.
.travis.yml:
env:
global:
- secure: "encrypted sauce username"
- secure: "encrypted sauce secret key"
- SAUCY: true
addons:
sauce_connect: true
Gemfile:
group :development, :test do
# other gems...
if ENV['SAUCY']
# gems for sauce
gem 'sauce', '~> 3.1.1'
gem 'sauce-connect'
gem 'parallel_tests'
end
end
spec/rails_helper.rb:
# after other requires
if ENV['SAUCY']
require 'sauce'
require 'sauce/capybara'
# change to "Capybara.default_driver = :sauce" to use sauce
# for ALL feature specs, not just ones marked with "js: true"
Capybara.javascript_driver = :sauce
Sauce.config do |config|
config[:browsers] = [
['Linux', 'Chrome', nil],
# and other OS/browser combos you want to support...
]
end
end
This way, I can also easily use Sauce locally if I choose to with:
SAUCY=true bundle install
SAUCY=true SAUCE_USERNAME=username SAUCE_ACCESS_KEY=access_key bundle exec rspec