These are chat archives for translate/dev

6th
Sep 2017
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:25
Hi, @phlax ! I am trying to rebase but it says I'm up to date. Can you please explain me a bit better what to do?
phlax
@phlax
Sep 06 2017 07:26
hi @jjmcarrascosa i rebased your pr against the 2.8.x branch
you will probably want to delete your local branch and checkout the one on github
altho
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:26
aaaah, ok!
phlax
@phlax
Sep 06 2017 07:27
im thinking now that we are getting closer to releasing 2.9 so it might actually be better to focus on that
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:27
what you think it's better :) What should I do then?
phlax
@phlax
Sep 06 2017 07:28
i think 2.8 is for bugfixes, so defo better to focus on 2.9.x
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:30
But there is still no branch 2.9.x right? What do I need to do then?
phlax
@phlax
Sep 06 2017 07:31
work against master
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:31
ok, so I delete what I have and checkout master
phlax
@phlax
Sep 06 2017 07:31
hmm
probs something like this...
git checkout fork-create-project
git checkout -b tmp_create_project
git branch -D fork-create-project
git checkout master
git fetch upstream
git rebase upstream/master
git checkout -b fork-create-project
git cherry-pick COMMITHASH
git push -f
you will need to get the COMMITHASH and there are 3 so you will need to repeat for each commit
hmm - also not sure if you have upstream set
so you will need to adjust according to what you have or add a remote
do you follow ?
phlax
@phlax
Sep 06 2017 07:37
@jjmcarrascosa if you want i can rebase your PR correctly and set it back to master as base branch
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:39
let me try to add a remote
ok I'm already in the cherry-pick command
phlax
@phlax
Sep 06 2017 07:44
cool, so cherry-pick the commits...
 0a3ff9a
 3ec2e6d
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:44
I was trying to get the hash
ohh great here they are :)
phlax
@phlax
Sep 06 2017 07:45
 2509510
ive switched the base branch on github
once you push back it should clean it up
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:46
oops it says "bad revision" for everyone, I have probably done some wrong
phlax
@phlax
Sep 06 2017 07:46
did you fetch upstream ?
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:48
```root@73e7d3b3c835:/home/pootle/pootle_dev/pootle# git fetch upstream
remote: Counting objects: 989, done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 989 (delta 647), reused 667 (delta 619), pack-reused 289
Receiving objects: 100% (989/989), 208.91 KiB | 0 bytes/s, done.
Resolving deltas: 100% (771/771), completed with 192 local objects.
From https://github.com/translate/pootle
  • [new branch] 2.0 -> upstream/2.0
  • [new branch] 2.1 -> upstream/2.1
  • [new branch] 2.8rc3 -> upstream/2.8rc3
  • [new branch] core -> upstream/core ```
oops sorry
phlax
@phlax
Sep 06 2017 07:48
i would not use root for gitting
anyhow, you should be able to cherry-pick those commits after fetch
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:51
root@73e7d3b3c835:/home/pootle/pootle_dev/pootle# git cherry-pick 0a3ff9a
fatal: bad revision '0a3ff9a'
root@73e7d3b3c835:/home/pootle/pootle_dev/pootle# git cherry-pick 3ec2e6d
fatal: bad revision '3ec2e6d'
root@73e7d3b3c835:/home/pootle/pootle_dev/pootle# git cherry-pick 2509510
fatal: bad revision '2509510'
phlax
@phlax
Sep 06 2017 07:52
wierd
let me clean up your PR
ah wait
do
git fetch origin
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:53
here it is!
I've done the cherry-picks already
now the push
right?
git push -f
phlax
@phlax
Sep 06 2017 07:54
cool, so now if you do git log you should have master + 3 extra commits
you will probs need to do --set-upstream again if you followed above
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:58
yes, seems I have master 3 extra commits. git push -f failed, yes, it says I need to set upstream.
this fails
git push --set-upstream origin fork-create-project
phlax
@phlax
Sep 06 2017 07:58
cool - you might need to add -f to that
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 07:59
oops you are right, i forgot.
it worked
greaaat, thank you.
phlax
@phlax
Sep 06 2017 07:59
next thing i would do
is squash the first 2 commits
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:00
ok
phlax
@phlax
Sep 06 2017 08:00
and move imports to top of file
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:01
keep me updated :) and tell me if I need to do anything
phlax
@phlax
Sep 06 2017 08:02
there is quite a few things that this needs
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:04
I see
So I need to add a default
for --name argument
right?
phlax
@phlax
Sep 06 2017 08:05
yep
well - maybe not exactly
but if its not set, you need to set something like code.capitalize() for example
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:08
ok. One more question. I see that we have
        english = Language.objects.get(code="en")
        new_project = Project.objects.create(code=options["code"], fullname=options["name"], source_language=english)
that means that we are forcing source lang to be English
don't we need to set also as a param?
phlax
@phlax
Sep 06 2017 08:09
yep - so that should havve an option
and default to en
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:09
ok i will do then these 2 things
phlax
@phlax
Sep 06 2017 08:09
ping me when you are done
(and squashed commits!)
ill add some more tests and you can add some more code 8/
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:30
ok. So now I commit the changes and squash _
?
phlax
@phlax
Sep 06 2017 08:31
yep
use git rebase -i HEAD~20 or similar to squash
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:31
yes, thank you.
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:36
I propose using HEAD~4 to squash only create_project commits. Or you prefer a bigger squash?
phlax
@phlax
Sep 06 2017 08:37
no - only the commits that you have added need squashing
dont include the test
i just suggested ~20 because i always do that by default
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:37
aaah yes, ok,
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:47
Ok I have squasehd, but there is one "Add tests for create_project command" I haven't squashed, that is between 2 commits of mine
I could squash everything, it's create_project command - related
of should I leave it as it is
phlax
@phlax
Sep 06 2017 08:48
you can reorder the commits so you can squash them
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:49
ah ok
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:54
Done
thank you for guiding almost in every step :)
phlax
@phlax
Sep 06 2017 08:54
if you push -f now i can see where we are at
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 08:56
done
phlax
@phlax
Sep 06 2017 09:01
ive left a couple of comments @jjmcarrascosa - can you address those, and ill add some more tests
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:13
@phlax yes I've changed everything, but accidentally squashed a commit with the tests :( How can I unsuash?
unsquash?
phlax
@phlax
Sep 06 2017 09:14
hmm, unsquashing is a bit of a pita
there are a few ways i do something like...
git log
get the commit hash before the one you are unsquashing
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:15
i'm using vim and I'm not very used to it accidentally used a wrong key command
phlax
@phlax
Sep 06 2017 09:15
git reset --soft COMMITHASH
git stash
git reset --hard COMMITHASH
git stash apply
and then re-commit the individual comits
you could also possibly use reflog
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:17
i'm going to try reflog
phlax
@phlax
Sep 06 2017 09:18
@jjmcarrascosa worth mentioning, whenever you push to a PR it will run tests on travis
the last test fails because of the line being too long
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:22
ok, undone the squash
phlax
@phlax
Sep 06 2017 09:22
cool
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:23
I'm taking a look at the travis error
phlax
@phlax
Sep 06 2017 09:23
i think its jst pep8 because of the long line i pointed out
so should be good after push
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:24
so do I leave it as it is?
with your changes?
phlax
@phlax
Sep 06 2017 09:24
yep, lets see from there
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:24
ok
phlax
@phlax
Sep 06 2017 09:30
@jjmcarrascosa ive commented again
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:30
:) ok, going to take a look
phlax
@phlax
Sep 06 2017 09:30
sorry to be picky, but it will fail tests if you dont format as expected
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:30
no, it's not your fault ! it's mine, so feel free to be as picky as needed
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:45
@phlax I've done verything, now struggling on how to squash because it doesn't let me no squash anything
phlax
@phlax
Sep 06 2017 09:46
not sure i follow @jjmcarrascosa
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:46
I have done all the changes you proposed
I haven't done the push -f yet though
because I want to squash first
right?
phlax
@phlax
Sep 06 2017 09:47
yep
there should be just 2 commits
yours, and my test
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 09:50
I have several (i was already commiting when I saw your new comments)
but it doesn't let me proceed with the squash
pick 5e67482 Add tests for create_project command
pick 63b5258 Added create_project pootle command and squashing minor development commits
pick 2a06cc5 Added create_project pootle command and squashing minor development commits
pick 95b2843 Import files and fullname minor changes in create_project
pick a5704ea Spacing issues and multiline in create_project
any squash at any line - doesn't allow me to proceed, idk why
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 10:04
Ah, I need a merge
phlax
@phlax
Sep 06 2017 10:04
you shouldnt need to merge anything
why cant you squash those commits ?
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 10:04
sorry, an add
fixed
phlax
@phlax
Sep 06 2017 10:04
also if you check travis, there are now a few issues
@jjmcarrascosa i have to afk for an hour or two, ill be back about after if you want to continue
@jjmcarrascosa ...
4     E101 indentation contains mixed spaces and tabs

1     E302 expected 2 blank lines, found 1

1     E501 line too long (102 > 84 characters)

1     F841 local variable 'new_project' is assigned to but never used

5     W191 indentation contains tabs

3     W291 trailing whitespace

make: *** [lint-flake8] Error 1
you migth want to pip install flake8 and then you can flake8 the file each time you make changes
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 10:07
Ok will fix everything
and install flake8 or it will take years :)
phlax
@phlax
Sep 06 2017 10:09
8)
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 10:21
@phlax done! the only warning now is about unsing var new_projcet
@phlax all the rest is fixed, commits squashed, pull -f done
phlax
@phlax
Sep 06 2017 12:05
ping @jjmcarrascosa - back
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:07
@phlax hi :)
phlax
@phlax
Sep 06 2017 12:10
just checking PR, looking good
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:10
@phlax yes, I used flake8
not it should not have any error
*noW
phlax
@phlax
Sep 06 2017 12:13
cool, im just updating the test i added...
so @jjmcarrascosa i enabled the test, and updated your PR
you probably need to rebase your local branch
(or maybe pull -f)
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:16
ok
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:21
done
phlax
@phlax
Sep 06 2017 12:21
cool, so we need to set a few more things
ill add some tests and you can see what we need to add...
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:22
great
phlax
@phlax
Sep 06 2017 12:33
@jjmcarrascosa i have updated the tests
you will see that i have again commented out some stuff, these are not currently set when you create a project
but should be by default, ill fix this shortly
the next thing we need to do is go through the cli options and for each make sure that when they are added on cli, the project is created correctly
as in the the title test
also worth mentioning, the option that you have added as "structure" is no longer required, but...
we need a similar option with translation_mapping
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:38
ok
phlax
@phlax
Sep 06 2017 12:49
so @jjmcarrascosa im gonna add some more failing tests, and if you can add the necessary code that would be great...
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:50
ok
how can I launch the tests
so that i see the errors
what is the command
phlax
@phlax
Sep 06 2017 12:51
you will need to install the dev requirements...
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:51
ah ok
phlax
@phlax
Sep 06 2017 12:51
pip install -r requirements/dev.txt
so @jjmcarrascosa can we rename the option here to "checkstyle" https://github.com/translate/pootle/pull/6633/files#diff-c8415804410419c7a8c9daf15b71c48cR35
as that is more consistent with ui/docs
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 12:55
sure
phlax
@phlax
Sep 06 2017 12:56
so to run tests @jjmcarrascosa we use py.test
there are a lot of tests, so generally you just want to run one/some tests
eg
py.test -vv -k test_cmd_create_project
also, if you check the PR i have added an xfailed test for checkstyle
so if we rename/enable it, we should be able to get the test to pass
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 13:00
my previous running installation of pootle crashed, now I got this error
pkg_resources.DistributionNotFound: The 'translate-toolkit==2.2.3' distribution was not found and is required by Pootle
phlax
@phlax
Sep 06 2017 13:00
try...
pip install -r requirements/base.txt
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 13:04
everything satisfied
weird :(
root@73e7d3b3c835:/home/pootle# pootle runserver 0.0.0.0:8000  --insecure
Traceback (most recent call last):
  File "/usr/local/bin/pootle", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3039, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3023, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3052, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 858, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'translate-toolkit==2.2.3' distribution was not found and is required by Pootle
root@73e7d3b3c835:/home/pootle#
phlax
@phlax
Sep 06 2017 13:06
how is pootle installed?
you might need/be able to do pip install -e . in the pootle directory
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 13:08
that fixed it
great
oops I mixed up everything I think :( I will need to install it again
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 13:47
@phlax come back to you tomorrow, installed the dev I have overwritten the installation I had in my docker and everything has messed up
phlax
@phlax
Sep 06 2017 13:47
nightmare 8/
@jjmcarrascosa it will take a while to get this code landed i think because there are quite a few options
but its really really helpful, so im up for helping move it along as quick as we can
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 13:48
ok will do it step by step
phlax
@phlax
Sep 06 2017 13:48
ill add some more failing tests and we can gradually fix them
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 13:50
yes, i'm installing the docker container again, then I will need to reset the database :) then pull the code from github, but that will be tomrrow. I think I will continue without the dev :)
phlax
@phlax
Sep 06 2017 13:50
cool
Jose J. Martinez
@jjmcarrascosa
Sep 06 2017 13:52
thank you very much!
ping to you tomorrow
phlax
@phlax
Sep 06 2017 13:52
laters